Struct reffers::rc::Ref

source · []
pub struct Ref<T: ?Sized + Repr, M: BitMask = u32>(_, _);
Expand description

An Rc reference which has immutable access to the inner value.

It’s like a strong reference, and a immutably borrowed interior, in the same struct.

Example

use reffers::rc::Ref;
use std::collections::HashMap;

let mut z = HashMap::new();
z.insert(<Ref<_>>::new_str("Test"), 5);
assert_eq!(z.get("Test"), Some(&5));

Implementations

Returns a new Ref, or panics if this is not possible

Will panic in case a RefMut is currently held, or there are no more Refs available

Returns a new Ref, or returns an error if there are no such references available

Will return an error in case a RefMut is currently held, or there are no more Refs available

👎 Deprecated:

Renamed to get_ref

Returns a new Ref, or panics if this is not possible

Will panic in case a RefMut is currently held, or there are no more Refs available

👎 Deprecated:

Renamed to try_get_ref

Returns a new Ref, or returns an error if there are no such references available

Will return an error in case a RefMut is currently held, or there are no more Refs available

Returns a new Weak reference, or panics if there are no such references available

Returns a new Strong reference, or panics if there are no such references available

Returns a new Weak reference, or returns an error if there are no such references available

Returns a new Strong reference, or returns an error if there are no such references available

Returns the current state

Reverts poisoning

Poisoning happens when a RefMut is dropped during a panic.

Creates a new reference.

Creates a new reference from a str.

Creates a new slice reference from an iterator.

Trait Implementations

Performs the conversion.

Immutably borrows from an owned value. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.