pub struct Wire<T>where
T: ?Sized,{ /* private fields */ }Expand description
Wraps and transfers complex objects over FFI.
The backing storage uses a (ptr, size) representation that can safely cross FFI boundaries. See the module documentation for more details and examples.
Implementations§
Source§impl<T: TypeInfo + WireIO> Wire<T>
impl<T: TypeInfo + WireIO> Wire<T>
Sourcepub fn try_from(value: T) -> Result<Self, SerializationError>
pub fn try_from(value: T) -> Result<Self, SerializationError>
Serialize value into a new owned Wire.
§Errors
Returns SerializationError if value cannot be serialized into the buffer.
Sourcepub fn try_unwire(&mut self) -> Result<T, SerializationError>
pub fn try_unwire(&mut self) -> Result<T, SerializationError>
Deserialize the value from this Wire’s buffer.
§Errors
Returns SerializationError if the buffer contents cannot be deserialized
into T (e.g., truncated buffer, malformed data).
Trait Implementations§
Source§impl<T: TypeInfo + WireIO> TypeInfo for Wire<T>
impl<T: TypeInfo + WireIO> TypeInfo for Wire<T>
Source§const ASYNC_SAFE: bool = true
const ASYNC_SAFE: bool = true
Whether this type can appear in an async service method.
Source§const SERVICE_SAFE: bool = true
const SERVICE_SAFE: bool = true
Whether this type can appear in a service method.
Source§const SERVICE_CTOR_SAFE: bool = true
const SERVICE_CTOR_SAFE: bool = true
Whether this type is valid as a service constructor return type.
Source§fn register(inventory: &mut impl Inventory)
fn register(inventory: &mut impl Inventory)
Registers this type and all its transitive dependencies with the inventory.
Source§const OPTION_PTR_SAFE: bool = false
const OPTION_PTR_SAFE: bool = false
Whether
std::Option<Self> uses a niche and is FFI-safe as a pointer
(e.g., references, NonNull, function pointers).Auto Trait Implementations§
impl<T> Freeze for Wire<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Wire<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Wire<T>
impl<T> Sync for Wire<T>
impl<T> Unpin for Wire<T>
impl<T> UnsafeUnpin for Wire<T>where
T: ?Sized,
impl<T> UnwindSafe for Wire<T>where
T: UnwindSafe + ?Sized,
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
Mutably borrows from an owned value. Read more