pub struct HandlerBodyCheck<'a> {Show 13 fields
pub body: &'a Block,
pub return_type: &'a TypeRef,
pub params: &'a [Param],
pub capabilities: HashMap<String, CapabilityInfo>,
pub declared_capabilities: HashMap<String, CapabilityInfo>,
pub given: &'a [CapRef],
pub given_anchor: Option<Span>,
pub report_unused: bool,
pub agent_state_ty: Option<TyId>,
pub agent_self_scope: Option<HashMap<String, TyId>>,
pub actor_binding: Option<(String, TyId)>,
pub store_fields: HashMap<String, StoreField>,
pub borrowed_held: HashSet<String>,
}Expand description
#522: everything check_handler_body needs to know about the handler —
signature, capability scope, agent state, and held bindings. Replaces what
was 17 positional parameters (of a 24-parameter signature); Self::new
fills the agent/actor/store extras with empties, so a simple site
(provider op, test body) sets only the fields it actually uses.
Fields§
§body: &'a Block§return_type: &'a TypeRef§params: &'a [Param]§capabilities: HashMap<String, CapabilityInfo>The capabilities the body may call (the handler’s resolved given).
declared_capabilities: HashMap<String, CapabilityInfo>Every declared capability, for “declared but not given” diagnostics.
given: &'a [CapRef]§given_anchor: Option<Span>§report_unused: bool§agent_state_ty: Option<TyId>An agent handler’s synthetic state-record type, when one is in scope.
agent_self_scope: Option<HashMap<String, TyId>>§actor_binding: Option<(String, TyId)>v0.45/v0.52: the by <binder>: <Actor(s)> binding — the binder name and
its fully-formed sealed type: Ty::Actor(identity) for a single actor
(so binder.identity type-checks), or Ty::ActorSum(members) for a sum
(so the body matches on it). None for handlers without a by binder.
store_fields: HashMap<String, StoreField>The agent’s store fields, by name (finding #36 — see StoreField),
so the := write form, <field>.<op>(…), and the map query accessors
can resolve their target. Empty for service/test bodies and state { } agents.
borrowed_held: HashSet<String>v0.106 (slice 3b-iii): held params that are borrowed, not owned —
the firing connection of a from websocket on message/on close.
Borrowed bindings admit non-consuming ops (send) but carry no disposal
obligation. Empty for every other handler (including on open, whose
connection is owned).
Implementations§
Auto Trait Implementations§
impl<'a> Freeze for HandlerBodyCheck<'a>
impl<'a> RefUnwindSafe for HandlerBodyCheck<'a>
impl<'a> Send for HandlerBodyCheck<'a>
impl<'a> Sync for HandlerBodyCheck<'a>
impl<'a> Unpin for HandlerBodyCheck<'a>
impl<'a> UnsafeUnpin for HandlerBodyCheck<'a>
impl<'a> UnwindSafe for HandlerBodyCheck<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);