devela::sys::mem::cell

Struct Cell

1.0.0 · Source
pub struct Cell<T>
where T: ?Sized,
{ /* private fields */ }
Expand description

core A mutable memory location.

Re-exported from core::cell:: .


A mutable memory location.

§Memory layout

Cell<T> has the same memory layout and caveats as UnsafeCell<T>. In particular, this means that Cell<T> has the same in-memory representation as its inner type T.

§Examples

In this example, you can see that Cell<T> enables mutation inside an immutable struct. In other words, it enables “interior mutability”.

use std::cell::Cell;

struct SomeStruct {
    regular_field: u8,
    special_field: Cell<u8>,
}

let my_struct = SomeStruct {
    regular_field: 0,
    special_field: Cell::new(1),
};

let new_value = 100;

// ERROR: `my_struct` is immutable
// my_struct.regular_field = new_value;

// WORKS: although `my_struct` is immutable, `special_field` is a `Cell`,
// which can always be mutated
my_struct.special_field.set(new_value);
assert_eq!(my_struct.special_field.get(), new_value);

See the module-level documentation for more.

Implementations§

Source§

impl<T> Cell<T>

1.0.0 (const: 1.24.0) · Source

pub const fn new(value: T) -> Cell<T>

Creates a new Cell containing the given value.

§Examples
use std::cell::Cell;

let c = Cell::new(5);
1.0.0 · Source

pub fn set(&self, val: T)

Sets the contained value.

§Examples
use std::cell::Cell;

let c = Cell::new(5);

c.set(10);
1.17.0 · Source

pub fn swap(&self, other: &Cell<T>)

Swaps the values of two Cells.

The difference with std::mem::swap is that this function doesn’t require a &mut reference.

§Panics

This function will panic if self and other are different Cells that partially overlap. (Using just standard library methods, it is impossible to create such partially overlapping Cells. However, unsafe code is allowed to e.g. create two &Cell<[i32; 2]> that partially overlap.)

§Examples
use std::cell::Cell;

let c1 = Cell::new(5i32);
let c2 = Cell::new(10i32);
c1.swap(&c2);
assert_eq!(10, c1.get());
assert_eq!(5, c2.get());
1.17.0 (const: unstable) · Source

pub fn replace(&self, val: T) -> T

Replaces the contained value with val, and returns the old contained value.

§Examples
use std::cell::Cell;

let cell = Cell::new(5);
assert_eq!(cell.get(), 5);
assert_eq!(cell.replace(10), 5);
assert_eq!(cell.get(), 10);
1.17.0 (const: 1.83.0) · Source

pub const fn into_inner(self) -> T

Unwraps the value, consuming the cell.

§Examples
use std::cell::Cell;

let c = Cell::new(5);
let five = c.into_inner();

assert_eq!(five, 5);
Source§

impl<T> Cell<T>
where T: Copy,

1.0.0 (const: unstable) · Source

pub fn get(&self) -> T

Returns a copy of the contained value.

§Examples
use std::cell::Cell;

let c = Cell::new(5);

let five = c.get();
Source

pub fn update<F>(&self, f: F) -> T
where F: FnOnce(T) -> T,

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

Updates the contained value using a function and returns the new value.

§Examples
#![feature(cell_update)]

use std::cell::Cell;

let c = Cell::new(5);
let new = c.update(|x| x + 1);

assert_eq!(new, 6);
assert_eq!(c.get(), 6);
Source§

impl<T> Cell<T>
where T: ?Sized,

1.12.0 (const: 1.32.0) · Source

pub const fn as_ptr(&self) -> *mut T

Returns a raw pointer to the underlying data in this cell.

§Examples
use std::cell::Cell;

let c = Cell::new(5);

let ptr = c.as_ptr();
1.11.0 (const: unstable) · Source

pub fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the underlying data.

This call borrows Cell mutably (at compile-time) which guarantees that we possess the only reference.

However be cautious: this method expects self to be mutable, which is generally not the case when using a Cell. If you require interior mutability by reference, consider using RefCell which provides run-time checked mutable borrows through its borrow_mut method.

§Examples
use std::cell::Cell;

let mut c = Cell::new(5);
*c.get_mut() += 1;

assert_eq!(c.get(), 6);
1.37.0 (const: unstable) · Source

pub fn from_mut(t: &mut T) -> &Cell<T>

Returns a &Cell<T> from a &mut T

§Examples
use std::cell::Cell;

let slice: &mut [i32] = &mut [1, 2, 3];
let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
let slice_cell: &[Cell<i32>] = cell_slice.as_slice_of_cells();

assert_eq!(slice_cell.len(), 3);
Source§

impl<T> Cell<T>
where T: Default,

1.17.0 · Source

pub fn take(&self) -> T

Takes the value of the cell, leaving Default::default() in its place.

§Examples
use std::cell::Cell;

let c = Cell::new(5);
let five = c.take();

assert_eq!(five, 5);
assert_eq!(c.into_inner(), 0);
Source§

impl<T> Cell<[T]>

1.37.0 (const: unstable) · Source

pub fn as_slice_of_cells(&self) -> &[Cell<T>]

Returns a &[Cell<T>] from a &Cell<[T]>

§Examples
use std::cell::Cell;

let slice: &mut [i32] = &mut [1, 2, 3];
let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
let slice_cell: &[Cell<i32>] = cell_slice.as_slice_of_cells();

assert_eq!(slice_cell.len(), 3);
Source§

impl<T, const N: usize> Cell<[T; N]>

Source

pub const fn as_array_of_cells(&self) -> &[Cell<T>; N]

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

Returns a &[Cell<T>; N] from a &Cell<[T; N]>

§Examples
#![feature(as_array_of_cells)]
use std::cell::Cell;

let mut array: [i32; 3] = [1, 2, 3];
let cell_array: &Cell<[i32; 3]> = Cell::from_mut(&mut array);
let array_cell: &[Cell<i32>; 3] = cell_array.as_array_of_cells();

Trait Implementations§

§

impl<F> ArchiveWith<Cell<F>> for Unsafe
where F: Archive,

§

type Archived = <F as Archive>::Archived

The archived type of Self with F.
§

type Resolver = <F as Archive>::Resolver

The resolver of a Self with F.
§

fn resolve_with( field: &Cell<F>, resolver: <Unsafe as ArchiveWith<Cell<F>>>::Resolver, out: Place<<Unsafe as ArchiveWith<Cell<F>>>::Archived>, )

Resolves the archived type using a reference to the field type F.
§

impl<T, C> CheckBytes<C> for Cell<T>
where T: CheckBytes<C> + ?Sized, C: Fallible + ?Sized, <C as Fallible>::Error: Trace,

§

unsafe fn check_bytes( value: *const Cell<T>, c: &mut C, ) -> Result<(), <C as Fallible>::Error>

Checks whether the given pointer points to a valid value within the given context. Read more
1.0.0 · Source§

impl<T> Clone for Cell<T>
where T: Copy,

Source§

fn clone(&self) -> Cell<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ConstDefault> ConstDefault for Cell<T>

Source§

const DEFAULT: Self

Returns the compile-time “default value” for a type.
1.0.0 · Source§

impl<T> Debug for Cell<T>
where T: Copy + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
1.0.0 · Source§

impl<T> Default for Cell<T>
where T: Default,

Source§

fn default() -> Cell<T>

Creates a Cell<T>, with the Default value for T.

Source§

impl<'de, T> Deserialize<'de> for Cell<T>
where T: Deserialize<'de> + Copy,

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Cell<T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<F, D> DeserializeWith<<F as Archive>::Archived, Cell<F>, D> for Unsafe
where F: Archive, <F as Archive>::Archived: Deserialize<F, D>, D: Fallible + ?Sized,

§

fn deserialize_with( field: &<F as Archive>::Archived, deserializer: &mut D, ) -> Result<Cell<F>, <D as Fallible>::Error>

Deserializes the field type F using the given deserializer.
§

impl<'a, T> Destructure for &'a Cell<T>
where T: ?Sized,

§

type Underlying = T

The underlying type that is destructured.
§

type Destructuring = Borrow

The type of destructuring to perform.
§

fn underlying(&mut self) -> *mut <&'a Cell<T> as Destructure>::Underlying

Returns a mutable pointer to the underlying type.
§

impl<'a, T> Destructure for &'a mut Cell<T>
where T: ?Sized,

§

type Underlying = T

The underlying type that is destructured.
§

type Destructuring = Borrow

The type of destructuring to perform.
§

fn underlying(&mut self) -> *mut <&'a mut Cell<T> as Destructure>::Underlying

Returns a mutable pointer to the underlying type.
§

impl<T> Destructure for Cell<T>

§

type Underlying = T

The underlying type that is destructured.
§

type Destructuring = Move

The type of destructuring to perform.
§

fn underlying(&mut self) -> *mut <Cell<T> as Destructure>::Underlying

Returns a mutable pointer to the underlying type.
Source§

impl<T> ExtCellOption<T> for Cell<Option<T>>

Source§

fn modify<F: FnOnce(T) -> T>(&self, func: F)

Modifies the value inside the Cell<Option<T>> by applying the provided closure to a mutable reference of the current value if present. Read more
Source§

fn modify_ret<F: FnOnce(T) -> T>(&self, func: F) -> Option<T>
where T: Clone,

Modifies the value inside the Cell<Option<T>> by applying the provided function and returns the old contained value. Read more
Source§

fn modify_mut<R, F: FnOnce(&mut T) -> R>(&self, func: F) -> Option<R>

Modifies the value inside the Cell<Option<T>> by applying the provided closure to a mutable reference of the current value if present, and returns a result. Read more
1.12.0 · Source§

impl<T> From<T> for Cell<T>

Source§

fn from(t: T) -> Cell<T>

Creates a new Cell<T> containing the given value.

§

impl<'py, T> FromPyObject<'py> for Cell<T>
where T: FromPyObject<'py>,

§

fn extract_bound(ob: &Bound<'py, PyAny>) -> Result<Cell<T>, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<T> IntoPy<Py<PyAny>> for Cell<T>
where T: Copy + IntoPy<Py<PyAny>>,

§

fn into_py(self, py: Python<'_>) -> Py<PyAny>

👎Deprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Performs the conversion.
§

impl<'py, T> IntoPyObject<'py> for &Cell<T>
where T: Copy + IntoPyObject<'py>,

§

type Target = <T as IntoPyObject<'py>>::Target

The Python output type
§

type Output = <T as IntoPyObject<'py>>::Output

The smart pointer type to use. Read more
§

type Error = <T as IntoPyObject<'py>>::Error

The type returned in the event of a conversion error.
§

fn into_pyobject( self, py: Python<'py>, ) -> Result<<&Cell<T> as IntoPyObject<'py>>::Output, <&Cell<T> as IntoPyObject<'py>>::Error>

Performs the conversion.
§

impl<'py, T> IntoPyObject<'py> for Cell<T>
where T: Copy + IntoPyObject<'py>,

§

type Target = <T as IntoPyObject<'py>>::Target

The Python output type
§

type Output = <T as IntoPyObject<'py>>::Output

The smart pointer type to use. Read more
§

type Error = <T as IntoPyObject<'py>>::Error

The type returned in the event of a conversion error.
§

fn into_pyobject( self, py: Python<'py>, ) -> Result<<Cell<T> as IntoPyObject<'py>>::Output, <Cell<T> as IntoPyObject<'py>>::Error>

Performs the conversion.
1.10.0 · Source§

impl<T> Ord for Cell<T>
where T: Ord + Copy,

Source§

fn cmp(&self, other: &Cell<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.0.0 · Source§

impl<T> PartialEq for Cell<T>
where T: PartialEq + Copy,

Source§

fn eq(&self, other: &Cell<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.10.0 · Source§

impl<T> PartialOrd for Cell<T>
where T: PartialOrd + Copy,

Source§

fn partial_cmp(&self, other: &Cell<T>) -> Option<Ordering>

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

fn lt(&self, other: &Cell<T>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Cell<T>) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &Cell<T>) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Cell<T>) -> bool

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

impl<'a, T, U> Restructure<U> for &'a Cell<T>
where U: 'a + ?Sized, T: ?Sized,

§

type Restructured = &'a Cell<U>

The restructured version of this type.
§

unsafe fn restructure( &self, ptr: *mut U, ) -> <&'a Cell<T> as Restructure<U>>::Restructured

Restructures a pointer to this type into the target type. Read more
§

impl<'a, T, U> Restructure<U> for &'a mut Cell<T>
where U: 'a + ?Sized, T: ?Sized,

§

type Restructured = &'a mut Cell<U>

The restructured version of this type.
§

unsafe fn restructure( &self, ptr: *mut U, ) -> <&'a mut Cell<T> as Restructure<U>>::Restructured

Restructures a pointer to this type into the target type. Read more
§

impl<T, U> Restructure<U> for Cell<T>

§

type Restructured = Cell<U>

The restructured version of this type.
§

unsafe fn restructure( &self, ptr: *mut U, ) -> <Cell<T> as Restructure<U>>::Restructured

Restructures a pointer to this type into the target type. Read more
Source§

impl<T> Serialize for Cell<T>
where T: Serialize + Copy,

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<F, S> SerializeWith<Cell<F>, S> for Unsafe
where F: Serialize<S>, S: Fallible + ?Sized,

§

fn serialize_with( field: &Cell<F>, serializer: &mut S, ) -> Result<<Unsafe as ArchiveWith<Cell<F>>>::Resolver, <S as Fallible>::Error>

Serializes the field type F using the given serializer.
§

impl<T> ToPyObject for Cell<T>
where T: Copy + ToPyObject,

§

fn to_object(&self, py: Python<'_>) -> Py<PyAny>

👎Deprecated since 0.23.0: ToPyObject is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Converts self into a Python object.
§

impl<T> Zeroable for Cell<T>
where T: Zeroable,

§

fn zeroed() -> Self

Source§

impl<T, U> CoerceUnsized<Cell<U>> for Cell<T>
where T: CoerceUnsized<U>,

Source§

impl<T, U> DispatchFromDyn<Cell<U>> for Cell<T>
where T: DispatchFromDyn<U>,

1.2.0 · Source§

impl<T> Eq for Cell<T>
where T: Eq + Copy,

Source§

impl<T> PinCoerceUnsized for Cell<T>
where T: ?Sized,

Source§

impl<T> PointerLike for Cell<T>
where T: PointerLike,

1.0.0 · Source§

impl<T> Send for Cell<T>
where T: Send + ?Sized,

1.0.0 · Source§

impl<T> !Sync for Cell<T>
where T: ?Sized,

Auto Trait Implementations§

§

impl<T> !Freeze for Cell<T>

§

impl<T> !RefUnwindSafe for Cell<T>

§

impl<T> Unpin for Cell<T>
where T: Unpin + ?Sized,

§

impl<T> UnwindSafe for Cell<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByteSized for T

Source§

const BYTE_ALIGN: usize = _

The alignment of this type in bytes.
Source§

const BYTE_SIZE: usize = _

The size of this type in bytes.
Source§

fn byte_align(&self) -> usize

Returns the alignment of this type in bytes.
Source§

fn byte_size(&self) -> usize

Returns the size of this type in bytes. Read more
Source§

fn ptr_size_ratio(&self) -> [usize; 2]

Returns the size ratio between Ptr::BYTES and BYTE_SIZE. Read more
Source§

impl<T, R> Chain<R> for T
where T: ?Sized,

Source§

fn chain<F>(self, f: F) -> R
where F: FnOnce(Self) -> R, Self: Sized,

Chain a function which takes the parameter by value.
Source§

fn chain_ref<F>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Chain a function which takes the parameter by shared reference.
Source§

fn chain_mut<F>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Chain a function which takes the parameter by exclusive reference.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ExtAny for T
where T: Any + ?Sized,

Source§

fn type_id() -> TypeId

Returns the TypeId of Self. Read more
Source§

fn type_of(&self) -> TypeId

Returns the TypeId of self. Read more
Source§

fn type_name(&self) -> &'static str

Returns the type name of self. Read more
Source§

fn type_is<T: 'static>(&self) -> bool

Returns true if Self is of type T. Read more
Source§

fn as_any_ref(&self) -> &dyn Any
where Self: Sized,

Upcasts &self as &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Upcasts &mut self as &mut dyn Any. Read more
Source§

fn as_any_box(self: Box<Self>) -> Box<dyn Any>
where Self: Sized,

Upcasts Box<self> as Box<dyn Any>. Read more
Source§

fn downcast_ref<T: 'static>(&self) -> Option<&T>

Available on crate feature unsafe_layout only.
Returns some shared reference to the inner value if it is of type T. Read more
Source§

fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T>

Available on crate feature unsafe_layout only.
Returns some exclusive reference to the inner value if it is of type T. Read more
Source§

impl<T> ExtMem for T
where T: ?Sized,

Source§

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.
Source§

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes. Read more
Source§

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes. Read more
Source§

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes. Read more
Source§

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes. Read more
Source§

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value. Read more
Source§

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters. Read more
Source§

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor. Read more
Source§

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor. Read more
Source§

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self. Read more
Source§

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self. Read more
Source§

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one. Read more
Source§

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

fn mem_as_bytes(&self) -> &[u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &[u8]. Read more
Source§

fn mem_as_bytes_mut(&mut self) -> &mut [u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &mut [u8]. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T> Hook for T

Source§

fn hook_ref<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Applies a function which takes the parameter by shared reference, and then returns the (possibly) modified owned value. Read more
Source§

fn hook_mut<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Applies a function which takes the parameter by exclusive reference, and then returns the (possibly) modified owned value. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

§

fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>

Converts self into an owned Python object, dropping type information.
§

fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>

Converts self into a Python object. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> Ungil for T
where T: Send,