pub trait WitBoundary: Sized {
type Wit;
// Required methods
fn to_wit(&self) -> Result<Self::Wit, String>;
fn from_wit(wit: Self::Wit) -> Result<Self, String>;
}Expand description
Converts a native host type to/from its generated WIT mirror.
to_wit borrows the native value (the host owns it); from_wit consumes
the WIT value (it arrived by value across the boundary). Both return
Result<_, String> — the WIT result<_, string> convention — so a value
that cannot be represented in the current WIT surface is a typed error, not
a panic or a silent drop.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl WitBoundary for Annotation
impl WitBoundary for Annotation
Source§impl WitBoundary for AppEffect
impl WitBoundary for AppEffect
Source§impl WitBoundary for AppliedEdit
impl WitBoundary for AppliedEdit
Source§impl WitBoundary for AppliedEdit
impl WitBoundary for AppliedEdit
Source§impl WitBoundary for ArgDefault
impl WitBoundary for ArgDefault
Source§impl WitBoundary for ArgKind
impl WitBoundary for ArgKind
Source§impl WitBoundary for ArgSpec
impl WitBoundary for ArgSpec
Source§impl WitBoundary for ArgValue
impl WitBoundary for ArgValue
Source§impl WitBoundary for Args
impl WitBoundary for Args
Source§impl WitBoundary for CandidateData
impl WitBoundary for CandidateData
Source§impl WitBoundary for CandidateKind
impl WitBoundary for CandidateKind
Source§impl WitBoundary for ContextScope
impl WitBoundary for ContextScope
Source§impl WitBoundary for EchoLevel
impl WitBoundary for EchoLevel
Source§impl WitBoundary for Edit
impl WitBoundary for Edit
Source§impl WitBoundary for EditDelta
impl WitBoundary for EditDelta
Source§impl WitBoundary for EditKind
impl WitBoundary for EditKind
Source§impl WitBoundary for Effect
impl WitBoundary for Effect
Source§type Wit = Vec<Effect>
type Wit = Vec<Effect>
Effect is recursive (Many(Vec<Effect>)), which WIT value types
cannot express. The boundary crosses a list<effect> instead: a
single effect is a one-element list, and Many (associative
composition) is flattened. from_wit rebuilds Many when the list has
more than one element; an empty list is Effect::None. A single-element
Many([x]) therefore normalises to x — a semantic identity, since
Many([x]) ≡ x.
fn to_wit(&self) -> Result<Vec<WitEffect>, String>
fn from_wit(wit: Vec<WitEffect>) -> Result<Self, String>
Source§impl WitBoundary for Event
impl WitBoundary for Event
Source§impl WitBoundary for EventKind
impl WitBoundary for EventKind
Source§impl WitBoundary for GutterDecoration
impl WitBoundary for GutterDecoration
Source§fn to_wit(&self) -> Result<WitGutterDecoration, String>
fn to_wit(&self) -> Result<WitGutterDecoration, String>
SG.4b: every native decoration is a Sign now, and a sign carries an
interned id whose NAME only the registry knows. This context-free
conversion does not have one, so both directions refuse by naming the
registry-aware pair rather than dropping the placement.
The impl is kept rather than deleted because it is what makes that refusal a compiler-checked total function: a future arm still has to decide here, and “needs a registry” is a decision worth being told about rather than discovered as a missing glyph.
type Wit = GutterDecoration
fn from_wit(wit: WitGutterDecoration) -> Result<Self, String>
Source§impl WitBoundary for GutterDiffKind
impl WitBoundary for GutterDiffKind
Source§impl WitBoundary for GutterSeverityLevel
impl WitBoundary for GutterSeverityLevel
Source§impl WitBoundary for HScroll
impl WitBoundary for HScroll
Source§impl WitBoundary for InsertLineEdit
impl WitBoundary for InsertLineEdit
Source§impl WitBoundary for KeyChord
impl WitBoundary for KeyChord
Source§impl WitBoundary for LatencyClass
Intern a plugin-supplied owned string as &'static str. SurfaceForm’s
impl WitBoundary for LatencyClass
Intern a plugin-supplied owned string as &'static str. SurfaceForm’s