Struct fungi_lang::shared::Shared [−][src]
pub struct Shared<T> { /* fields omitted */ }
A shared instance of T that serializes once, not once per reference.
Unlike a "bare" RcId
, single machine word on modern machines).
In particular, a shared T has a unique ID permitting table-based
indirection, via temporary storage used by serialization and
serialization logic; by contrast, a bare Rc
Methods
impl<T: Hash + 'static> Shared<T>
[src]
impl<T: Hash + 'static> Shared<T>
pub fn id(&self) -> Id
[src]
pub fn id(&self) -> Id
pub fn new(t: T) -> Shared<T>
[src]
pub fn new(t: T) -> Shared<T>
pub fn from_rc(rc: Rc<T>) -> Shared<T>
[src]
pub fn from_rc(rc: Rc<T>) -> Shared<T>
Trait Implementations
impl<T: Clone> Clone for Shared<T>
[src]
impl<T: Clone> Clone for Shared<T>
fn clone(&self) -> Shared<T>
[src]
fn clone(&self) -> Shared<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: PartialEq + 'static> PartialEq for Shared<T>
[src]
impl<T: PartialEq + 'static> PartialEq for Shared<T>
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: PartialEq + 'static> Eq for Shared<T>
[src]
impl<T: PartialEq + 'static> Eq for Shared<T>
impl<T: 'static + Hash> Hash for Shared<T>
[src]
impl<T: 'static + Hash> Hash for Shared<T>
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Debug> Debug for Shared<T>
[src]
impl<T: Debug> Debug for Shared<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Deref for Shared<T>
[src]
impl<T> Deref for Shared<T>
We may deference a (deserialized) Shared
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
fn deref(&self) -> &T
Dereferences the value.
impl<T: Serialize + Hash + 'static> Serialize for Shared<T>
[src]
impl<T: Serialize + Hash + 'static> Serialize for Shared<T>
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de, T: Deserialize<'de> + Hash + 'static> Deserialize<'de> for Shared<T>
[src]
impl<'de, T: Deserialize<'de> + Hash + 'static> Deserialize<'de> for Shared<T>
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more