pub struct ArcWeak<T: ?Sized> { /* private fields */ }Expand description
A serializable wrapper around std::sync::Weak<T> (thread-safe).
ArcWeak<T> works exactly like RcWeak<T> but is intended for use with
multi-threaded shared graphs where strong pointers are Arc<T>.
All clones of an ArcWeak<T> share the same UnsafeCell so deserialization
updates propagate to all copies.
§Example
See module-level docs for an Arc<Mutex<Node>> usage example.
Implementations§
Trait Implementations§
Source§impl<T: ForyDefault> ForyDefault for ArcWeak<T>
impl<T: ForyDefault> ForyDefault for ArcWeak<T>
Source§fn fory_default() -> Self
fn fory_default() -> Self
Creates a default value for this type. Read more
Source§impl<T: Serializer + ForyDefault + Send + Sync + 'static> Serializer for ArcWeak<T>
impl<T: Serializer + ForyDefault + Send + Sync + 'static> Serializer for ArcWeak<T>
Check if this type is a shared reference (Rc/Arc). Read more
Source§fn fory_write(
&self,
context: &mut WriteContext<'_>,
write_ref_info: bool,
write_type_info: bool,
has_generics: bool,
) -> Result<(), Error>
fn fory_write( &self, context: &mut WriteContext<'_>, write_ref_info: bool, write_type_info: bool, has_generics: bool, ) -> Result<(), Error>
Entry point for serialization. Read more
Source§fn fory_write_data_generic(
&self,
_: &mut WriteContext<'_>,
_: bool,
) -> Result<(), Error>
fn fory_write_data_generic( &self, _: &mut WriteContext<'_>, _: bool, ) -> Result<(), Error>
Write data with generic type parameter support. Read more
Source§fn fory_write_data(&self, _: &mut WriteContext<'_>) -> Result<(), Error>
fn fory_write_data(&self, _: &mut WriteContext<'_>) -> Result<(), Error>
[USER IMPLEMENTATION REQUIRED] Serialize the type’s data to the buffer. Read more
Source§fn fory_write_type_info(context: &mut WriteContext<'_>) -> Result<(), Error>
fn fory_write_type_info(context: &mut WriteContext<'_>) -> Result<(), Error>
Write type metadata to the buffer. Read more
Source§fn fory_read(
context: &mut ReadContext<'_>,
read_ref_info: bool,
read_type_info: bool,
) -> Result<Self, Error>
fn fory_read( context: &mut ReadContext<'_>, read_ref_info: bool, read_type_info: bool, ) -> Result<Self, Error>
Entry point for deserialization. Read more
Source§fn fory_read_with_type_info(
context: &mut ReadContext<'_>,
read_ref_info: bool,
typeinfo: Rc<TypeInfo>,
) -> Result<Self, Error>
fn fory_read_with_type_info( context: &mut ReadContext<'_>, read_ref_info: bool, typeinfo: Rc<TypeInfo>, ) -> Result<Self, Error>
Deserialize with pre-read type information. Read more
Source§fn fory_read_data(_: &mut ReadContext<'_>) -> Result<Self, Error>
fn fory_read_data(_: &mut ReadContext<'_>) -> Result<Self, Error>
[USER IMPLEMENTATION REQUIRED] Deserialize the type’s data from the buffer. Read more
Source§fn fory_read_type_info(context: &mut ReadContext<'_>) -> Result<(), Error>
fn fory_read_type_info(context: &mut ReadContext<'_>) -> Result<(), Error>
Read and validate type metadata from the buffer. Read more
Source§fn fory_reserved_space() -> usize
fn fory_reserved_space() -> usize
Hint for buffer pre-allocation size. Read more
Source§fn fory_get_type_id(type_resolver: &TypeResolver) -> Result<u32, Error>
fn fory_get_type_id(type_resolver: &TypeResolver) -> Result<u32, Error>
Get the registered type ID from the type resolver. Read more
Source§fn fory_type_id_dyn(&self, type_resolver: &TypeResolver) -> Result<u32, Error>
fn fory_type_id_dyn(&self, type_resolver: &TypeResolver) -> Result<u32, Error>
[USER IMPLEMENTATION REQUIRED] Get the runtime type ID for this instance. Read more
Source§fn fory_static_type_id() -> TypeId
fn fory_static_type_id() -> TypeId
Get the static Fory type ID for this type. Read more
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
[USER IMPLEMENTATION REQUIRED] Downcast to
&dyn Any for dynamic type checking. Read moreSource§fn fory_is_none(&self) -> bool
fn fory_is_none(&self) -> bool
Check if this instance represents a
None value. Read moreSource§fn fory_is_polymorphic() -> boolwhere
Self: Sized,
fn fory_is_polymorphic() -> boolwhere
Self: Sized,
Check if this type supports polymorphic serialization. Read more
fn fory_is_wrapper_type() -> boolwhere
Self: Sized,
Source§fn fory_concrete_type_id(&self) -> TypeId
fn fory_concrete_type_id(&self) -> TypeId
Get Rust’s
std::any::TypeId for this instance. Read moreimpl<T: ?Sized + Send + Sync> Send for ArcWeak<T>
impl<T: ?Sized + Send + Sync> Sync for ArcWeak<T>
Auto Trait Implementations§
impl<T> Freeze for ArcWeak<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for ArcWeak<T>
impl<T> Unpin for ArcWeak<T>where
T: ?Sized,
impl<T> !UnwindSafe for ArcWeak<T>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)