pub struct RustConstructorResourceBox {
pub id: RustConstructorId,
pub content: Box<dyn RustConstructorResource>,
}Expand description
Container for Rust Constructor resources with type-erased storage.
具有类型擦除存储的Rust Constructor资源的容器。
This struct pairs a resource identifier with the actual resource content, allowing for heterogeneous storage of different resource types while maintaining the ability to identify and manage them individually.
这个结构体将资源标识符与实际资源内容配对,允许不同资源类型的异构存储,同时保持单独识别和管理它们的能力。
§Type Erasure 类型擦除
The content field uses a Box<dyn RustConstructorResource> to store
any type that implements the RustConstructorResource trait, enabling
polymorphic behavior and storage.
content字段使用Box<dyn RustConstructorResource>来存储任何实现RustConstructorResource
特征的类型,从而启用多态行为和存储。
Fields§
§id: RustConstructorIdUnique identifier for the contained resource.
所包含资源的唯一标识符。
content: Box<dyn RustConstructorResource>Type-erased resource content.
类型擦除的资源内容。
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RustConstructorResourceBox
impl !RefUnwindSafe for RustConstructorResourceBox
impl !Send for RustConstructorResourceBox
impl !Sync for RustConstructorResourceBox
impl Unpin for RustConstructorResourceBox
impl UnsafeUnpin for RustConstructorResourceBox
impl !UnwindSafe for RustConstructorResourceBox
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more