[−][src]Struct rustc_data_structures::sync::Once
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A type whose inner value can be written once and then will stay read-only
Methods
impl<T> Once<T>
[src]
impl<T> Once<T>
pub fn new() -> Self
[src]
pub fn new() -> Self
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Creates an Once value which is uninitialized
pub fn into_inner(self) -> Option<T>
[src]
pub fn into_inner(self) -> Option<T>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Consumes the value and returns Some(T) if it was initialized
pub fn try_set(&self, value: T) -> Option<T>
[src]
pub fn try_set(&self, value: T) -> Option<T>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value to value
.
Returns None
if the inner value was uninitialized and value
was consumed setting it
otherwise if the inner value was already set it returns value
back to the caller
pub fn try_set_same(&self, value: T) -> Option<T> where
T: Eq,
[src]
pub fn try_set_same(&self, value: T) -> Option<T> where
T: Eq,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value to value
.
Returns None
if the inner value was uninitialized and value
was consumed setting it
otherwise if the inner value was already set it asserts that value
is equal to the inner
value and then returns value
back to the caller
pub fn set(&self, value: T)
[src]
pub fn set(&self, value: T)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value to value
and panics if it was already initialized
pub fn init_locking<F: FnOnce() -> T>(&self, f: F) -> bool
[src]
pub fn init_locking<F: FnOnce() -> T>(&self, f: F) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value by calling the closure while ensuring that no-one else
can access the value in the mean time by holding a lock for the duration of the closure.
If the value was already initialized the closure is not called and false
is returned,
otherwise if the value from the closure initializes the inner value, true
is returned
pub fn init_nonlocking<F: FnOnce() -> T>(&self, f: F) -> Option<T>
[src]
pub fn init_nonlocking<F: FnOnce() -> T>(&self, f: F) -> Option<T>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value by calling the closure without ensuring that no-one
else can access it. This mean when this is called from multiple threads, multiple
closures may concurrently be computing a value which the inner value should take.
Only one of these closures are used to actually initialize the value.
If some other closure already set the value,
we return the value our closure computed wrapped in a Option
.
If our closure set the value, None
is returned.
If the value is already initialized, the closure is not called and None
is returned.
pub fn init_nonlocking_same<F: FnOnce() -> T>(&self, f: F) -> Option<T> where
T: Eq,
[src]
pub fn init_nonlocking_same<F: FnOnce() -> T>(&self, f: F) -> Option<T> where
T: Eq,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to initialize the inner value by calling the closure without ensuring that no-one
else can access it. This mean when this is called from multiple threads, multiple
closures may concurrently be computing a value which the inner value should take.
Only one of these closures are used to actually initialize the value.
If some other closure already set the value, we assert that it our closure computed
a value equal to the value already set and then
we return the value our closure computed wrapped in a Option
.
If our closure set the value, None
is returned.
If the value is already initialized, the closure is not called and None
is returned.
pub fn try_get(&self) -> Option<&T>
[src]
pub fn try_get(&self) -> Option<&T>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Tries to get a reference to the inner value, returns None
if it is not yet initialized
ⓘImportant traits for &'a mut Rpub fn get(&self) -> &T
[src]
pub fn get(&self) -> &T
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Gets reference to the inner value, panics if it is not yet initialized
ⓘImportant traits for &'a mut Rpub fn borrow(&self) -> &T
[src]
pub fn borrow(&self) -> &T
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Gets reference to the inner value, panics if it is not yet initialized
Auto Trait Implementations
Blanket Implementations
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
[src]
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more
impl<T> Erased for T
impl<T> Erased for T