Skip to main content

WrappableSharedHandle

Trait WrappableSharedHandle 

Source
pub trait WrappableSharedHandle<T: 'static>: SharedHandle<T> {
    // Required method
    fn wrap(value: T) -> Self;
}
Expand description

Extension of SharedHandle for handles that can be constructed inline from an owned T.

Required by Server constructors that build the underlying T internally (the alloc-using path — e.g., Server::new_with_deps calls factory.bind(...).await? to get an F::Socket, then H::wrap(socket) to place it behind the caller’s chosen shared-storage). The no-alloc counterpart constructors (Server::new_with_handles) take pre-built handles directly and don’t need this trait.

&'static T deliberately does NOT implement this trait — materializing a &'static T from an owned T inside a trait method’s body requires an allocator (Box::leak) or a slot-based init pattern (StaticCell::init) that the trait method’s signature can’t express. No-alloc consumers declare their static storage themselves and pass &STATIC into the no-wrap constructor.

Required Methods§

Source

fn wrap(value: T) -> Self

Place an owned T behind this handle’s shared storage.

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<T: 'static> WrappableSharedHandle<T> for Arc<T>

Available on crate feature _alloc only.
Source§

fn wrap(value: T) -> Self

Implementors§