Struct FrozenGraph

Source
pub struct FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,
{ /* private fields */ }
Expand description

A Graph with immutable structure.

You can not add/remove nodes/edges from a FrozenGraph, but you can still mutate their weights in case you have a mutable reference to the graph.

Graph is effectively a smart pointer into a FrozenGraph so the conversion is free.

Implementations§

Source§

impl<N, E, NI, EI, NM, EM> FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source

pub fn node(&self, index: NI) -> Option<&Node<N, EI>>

Returns an immutable reference to a node by its index or None if the index is invalid.

Source

pub fn node_mut(&mut self, index: NI) -> Option<&mut Node<N, EI>>

Returns a mutable reference to a node by its index or None if the index is invalid.

Source

pub fn nodes_count(&self) -> usize

Returns the current amount of nodes in the graph.

Source

pub fn node_weight(&self, index: NI) -> Option<&N>

Returns an immutable reference to the weight of a node by its index or None in case the index is not valid.

§Example
let mut graph = SlotMapGraph::<i32, ()>::default();

let node = graph.add_node(1);
assert_eq!(graph.node_weight(node), Some(&1));
Source

pub fn node_weight_mut(&mut self, index: NI) -> Option<&mut N>

Returns a mutable reference to the weight of a node by its index or None in case the index is not valid.

§Example
let mut graph = SlotMapGraph::<i32, ()>::default();

let node = graph.add_node(1);
let weight_mut = graph.node_weight_mut(node).unwrap();
assert_eq!(*weight_mut, 1);

*weight_mut = 2;
assert_eq!(graph.node_weight(node), Some(&2));
Source

pub fn edge(&self, index: EI) -> Option<&Edge<E, NI, EI>>

Returns an immutable reference to an edge by its index or None if the index is invalid.

Source

pub fn edge_mut(&mut self, index: EI) -> Option<&mut Edge<E, NI, EI>>

Returns a mutable reference to an edge by its index or None if the index is invalid.

Source

pub fn edges_count(&self) -> usize

Returns the current amount of edges in the graph.

Source

pub fn edge_weight(&self, index: EI) -> Option<&E>

Returns an immutable reference to the weight of a node by its index or None in case the index is not valid.

§Example
let mut graph = SlotMapGraph::<i32, i32>::default();

let from = graph.add_node(1234);
let to = graph.add_node(1234);
let edge = graph.add_edge(4567, from, to).unwrap();

assert_eq!(graph.edge_weight(edge), Some(&4567));
§Panics

This function will panic if the provided edge index is not valid.

Source

pub fn edge_weight_mut(&mut self, index: EI) -> Option<&mut E>

Returns a mutable reference to the weight of an edge by its index.

§Panics

This function will panic if the provided edge index is not valid.

Source

pub fn as_nodes_mut_and_edges( &mut self, ) -> (&mut Nodes<N, EI, NM>, &Edges<E, NI, EI, EM>)

Given a mutable reference to a graph returns a mutable reference to its Nodes and an immutable reference to its Edges.

This is useful for parallel processing of a graph when its necessary to both mutate nodes and walk over edges.

Source

pub fn as_nodes_and_edges_mut( &mut self, ) -> (&Nodes<N, EI, NM>, &mut Edges<E, NI, EI, EM>)

Given a mutable reference to a graph returns an immutable reference to its Nodes and a mutable reference to its Edges.

This is useful for parallel processing of a graph when its necessary to both mutate edges and walk over nodes.

Source

pub fn as_nodes_mut_and_edges_mut( &mut self, ) -> (&mut Nodes<N, EI, NM>, &mut Edges<E, NI, EI, EM>)

Given a mutable reference to a graph returns a mutable reference to its Nodes and a mutable reference to its Edges.

This is useful for parallel processing of a graph when its necessary to mutably process both nodes and edges in parallel somehow.

Source

pub fn find_edge( &self, from: NI, to: NI, ) -> Result<Option<EI>, InvalidEdgeError>

Finds an edge from one node to another and returns its index.

§Example
let mut graph = SlotMapGraph::<i32, ()>::default();

let first = graph.add_node(1);
let second = graph.add_node(2);
let edge = graph.add_edge((), first, second).unwrap();

assert_eq!(graph.find_edge(first, second).unwrap(), Some(edge));
§Errors

This function will return an InvalidEdgeError error in case either the source or the destination index is not valid which will be indicated by the error’s value.

Source

pub fn find_node<F: FnMut(&N) -> bool>(&self, f: F) -> Option<NI>

Calls the given closure on each node in the index growth order passing the node’s weight as a parameter until the closure returns true. Returns the index of the node for which the closure returned true or None in case there was no such node.

§Example
let mut graph = SlotMapGraph::<bool, ()>::default();
let false_idx = graph.add_node(false);
let true_idx = graph.add_node(true);

assert_eq!(graph.find_node(|v| *v), Some(true_idx));
assert_eq!(graph.find_node(|v| !*v), Some(false_idx));
Source

pub fn node_weights(&self) -> NodeWeights<'_, N, NI, EI, NM>

Returns an immutable iterator over the weights of nodes in a graph.

§Order of iteration

The order of iteration is specified by the iterator type provided by the node map in its Map implementation as the Map::Iter associated type.

Source

pub fn node_weights_mut(&mut self) -> NodeWeightsMut<'_, N, NI, EI, NM>

Returns a mutable iterator over the weights of nodes in a graph.

§Order of iteration

The order of iteration is specified by the iterator type provided by the node map in its Map implementation as the Map::IterMut associated type.

Source

pub fn edge_weights(&self) -> EdgeWeights<'_, E, NI, EI, EM>

Returns an immutable iterator over the weights of edges in a graph.

§Order of iteration

The order of iteration is specified by the iterator type provided by the edge map in its Map implementation as the Map::Iter associated type.

Source

pub fn edge_weights_mut(&mut self) -> EdgeWeightsMut<'_, E, NI, EI, EM>

Returns a mutable iterator over the weights of edges in a graph.

§Order of iteration

The order of iteration is specified by the iterator type provided by the edge map in its Map implementation as the Map::IterMut associated type.

Source

pub fn outputs(&self, node_index: NI) -> Outputs<'_, E, NI, EI, EM>

Returns an iterator over the outputs of a node.

§Example
let mut graph = SlotMapGraph::<i32, i32>::default();

let entry = graph.add_node(1);
let (left, left_ei) = graph.add_connected_node(2, entry, 22).unwrap();
let (right, right_ei) = graph.add_connected_node(3, entry, 33).unwrap();

// make a map for expected edge weights
let mut map = HashMap::new();
map.insert(left_ei, 22);
map.insert(right_ei, 33);

// check that they match what we get from the iterator
for (ei, edge) in graph.outputs(entry) {
    assert_eq!(map.remove(&ei), Some(*edge.weight()));
}

assert!(map.is_empty());
Source

pub fn inputs(&self, node_index: NI) -> Inputs<'_, E, NI, EI, EM>

Returns an iterator over the inputs of a node.

§Example
let mut graph = SlotMapGraph::<i32, i32>::default();

let left = graph.add_node(1);
let right = graph.add_node(2);
let exit = graph.add_node(3);
let left_ei = graph.add_edge(11, left, exit).unwrap();
let right_ei = graph.add_edge(22, right, exit).unwrap();

// make a map for expected edge weights
let mut map = HashMap::new();
map.insert(left_ei, 11);
map.insert(right_ei, 22);

// check that they match what we get from the iterator
for (ei, edge) in graph.inputs(exit) {
    assert_eq!(map.remove(&ei), Some(*edge.weight()));
}

assert!(map.is_empty());
Source

pub fn successors(&self, node_index: NI) -> Successors<'_, N, E, NI, EI, NM, EM>

Returns an iterator over successors of a node.

§Example
let mut graph = SlotMapGraph::<i32, ()>::default();

let entry = graph.add_node(1);
let (left, left_ei) = graph.add_connected_node(2, entry, ()).unwrap();
let (right, right_ei) = graph.add_connected_node(3, entry, ()).unwrap();

// make a map for expected edge weights
let mut map = HashMap::new();
map.insert(left, 2);
map.insert(right, 3);

// check that they match what we get from the iterator
for (ni, weight) in graph.successors(entry) {
    assert_eq!(map.remove(&ni), Some(*weight));
}

assert!(map.is_empty());
Source

pub fn predecessors( &self, node_index: NI, ) -> Predecessors<'_, N, E, NI, EI, NM, EM>

Returns an iterator over predecessors of a node.

§Example
let mut graph = SlotMapGraph::<i32, ()>::default();

let left = graph.add_node(1);
let right = graph.add_node(2);
let exit = graph.add_node(3);
let left_ei = graph.add_edge((), left, exit).unwrap();
let right_ei = graph.add_edge((), right, exit).unwrap();

// make a map for expected edge weights
let mut map = HashMap::new();
map.insert(left, 1);
map.insert(right, 2);

// check that they match what we get from the iterator
for (ni, weight) in graph.predecessors(exit) {
    assert_eq!(map.remove(&ni), Some(*weight));
}

assert!(map.is_empty());
Source

pub fn walk_successors(&self, node_index: NI) -> WalkSuccessors<EI>

Returns a walker over the successors of a node.

Source

pub fn walk_predecessors(&self, node_index: NI) -> WalkPredecessors<EI>

Returns a walker over the predecessors of a node.

Source

pub fn walk_inputs(&self, node_index: NI) -> WalkInputs<EI>

Returns a walker over the inputs of a node.

Source

pub fn walk_outputs(&self, node_index: NI) -> WalkOutputs<EI>

Returns a walker over the outputs of a node.

Source

pub fn unfreeze(self) -> Graph<N, E, NI, EI, NM, EM>

Converts a FrozenGraph into a Graph.

Source§

impl<N, E, NI, EI, NM, EM> FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Ord + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: OrderedKeyMap<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source

pub fn nodes_range<R: RangeBounds<NI>>( &self, range: R, ) -> impl DoubleEndedIterator<Item = (NI, &N)>

Returns an immutable iterator over nodes with indices that fall into the specified range.

§Order of iteration

The order the nodes are returned in depends on the range iterator type provided by the node map in its OrderedKeyMap implementation as the OrderedKeyMap::Range associated type.

Source

pub fn nodes_range_mut<R: RangeBounds<NI>>( &mut self, range: R, ) -> impl DoubleEndedIterator<Item = (NI, &mut N)>

Returns a mutable iterator over nodes with indices that fall into the specified range.

§Example
let mut graph = BTreeSlotMapGraph::<i32, (), i32>::default();

graph.try_add_node_at_index(1, 111).unwrap();
graph.try_add_node_at_index(2, 222).unwrap();
graph.try_add_node_at_index(3, 333).unwrap();

let mut iter = graph.nodes_range_mut(2..=3);

let (index, value) = iter.next().unwrap();
assert_eq!(index, 2);
assert_eq!(mem::replace(value, 223), 222);

let (index, value) = iter.next().unwrap();
assert_eq!(index, 3);
assert_eq!(mem::replace(value, 334), 333);

assert!(iter.next().is_none());

drop(iter);

assert_eq!(*graph.node_weight(1).unwrap(), 111);
assert_eq!(*graph.node_weight(2).unwrap(), 223);
assert_eq!(*graph.node_weight(3).unwrap(), 334);
§Order of iteration

The order the nodes are returned in depends on the range iterator type provided by the node map in its OrderedKeyMap implementation as the OrderedKeyMap::RangeMut associated type.

Source

pub fn first_node(&self) -> Option<(NI, &N)>

Returns the index and an immutable reference to the weight of the first node in the graph.

§Order of nodes

What node is first is defined by the underlying node map by its implementation of the OrderedKeyMap::first method.

Source

pub fn first_node_mut(&mut self) -> Option<(NI, &mut N)>

Returns the index and a mutable reference to the weight of the first node in the graph.

§Order of nodes

What node is first is defined by the underlying node map by its implementation of the OrderedKeyMap::first_mut method.

Source

pub fn last_node(&self) -> Option<(NI, &N)>

Returns the index and an immutable reference to the weight of the first node in the graph.

§Order of nodes

What node is last is defined by the underlying node map by its implementation of the OrderedKeyMap::last method.

Source

pub fn last_node_mut(&mut self) -> Option<(NI, &mut N)>

Returns the index and a mutable reference to the weight of the first node in the graph.

§Order of nodes

What node is last is defined by the underlying node map by its implementation of the OrderedKeyMap::last_mut method.

Source§

impl<N, E, NI, EI, NM, EM> FrozenGraph<N, E, NI, EI, NM, EM>
where N: Send + Sync, NI: Copy + Eq + Ord + Send + Sync + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: ParIterMap<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source

pub fn par_iter_nodes(&self) -> NM::ParIter<'_>

Available on crate feature rayon only.

Returns an immutable parallel iterator over the graph’s nodes.

Source

pub fn par_iter_nodes_mut(&mut self) -> NM::ParIterMut<'_>

Available on crate feature rayon only.

Returns a mutable parallel iterator over the graph’s nodes.

Source

pub fn par_iter_node_weights( &self, ) -> Map<NM::ParIter<'_>, for<'a> fn((NI, &'a Node<N, EI>)) -> (NI, &'a N)>

Available on crate feature rayon only.

Returns an immutable parallel iterator over the graph’s nodes’ weights.

Source

pub fn par_iter_node_weights_mut( &mut self, ) -> Map<NM::ParIterMut<'_>, for<'a> fn((NI, &'a mut Node<N, EI>)) -> (NI, &'a mut N)>

Available on crate feature rayon only.

Returns a mutable parallel iterator over the graph’s nodes’ weights.

Source§

impl<N, E, NI, EI, NM, EM> FrozenGraph<N, E, NI, EI, NM, EM>
where E: Send + Sync, NI: Copy + Eq + Ord + Send + Sync + Debug + 'static, EI: Copy + Eq + Send + Sync + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI> + ParIterMap<Edge<E, NI, EI>, Key = EI>,

Source

pub fn par_iter_edges(&self) -> EM::ParIter<'_>

Available on crate feature rayon only.

Returns an immutable parallel iterator over the graph’s edges.

Source

pub fn par_iter_edges_mut(&mut self) -> EM::ParIterMut<'_>

Available on crate feature rayon only.

Returns a mutable parallel iterator over the graph’s edges.

Source

pub fn par_iter_edge_weights( &self, ) -> ParMap<EM::ParIter<'_>, for<'a> fn((EI, &'a Edge<E, NI, EI>)) -> (EI, &'a E)>

Available on crate feature rayon only.

Returns an immutable parallel iterator over the graph’s edges’ weights.

Source

pub fn par_iter_edge_weights_mut( &mut self, ) -> ParMap<EM::ParIterMut<'_>, for<'a> fn((EI, &'a mut Edge<E, NI, EI>)) -> (EI, &'a mut E)>

Available on crate feature rayon only.

Returns a mutable parallel iterator over the graph’s edges’ weights.

Trait Implementations§

Source§

impl<N, E, NI, EI, NM, EM> AsMut<FrozenGraph<N, E, NI, EI, NM, EM>> for Graph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn as_mut(&mut self) -> &mut FrozenGraph<N, E, NI, EI, NM, EM>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<N, E, NI, EI, NM, EM> AsRef<FrozenGraph<N, E, NI, EI, NM, EM>> for Graph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn as_ref(&self) -> &FrozenGraph<N, E, NI, EI, NM, EM>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<N, E, NI, EI, NM, EM> Borrow<FrozenGraph<N, E, NI, EI, NM, EM>> for Graph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn borrow(&self) -> &FrozenGraph<N, E, NI, EI, NM, EM>

Immutably borrows from an owned value. Read more
Source§

impl<N, E, NI, EI, NM, EM> BorrowMut<FrozenGraph<N, E, NI, EI, NM, EM>> for Graph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn borrow_mut(&mut self) -> &mut FrozenGraph<N, E, NI, EI, NM, EM>

Mutably borrows from an owned value. Read more
Source§

impl<N: Clone, E: Clone, NI, EI, NM, EM> Clone for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static + Clone, EI: Copy + Eq + Debug + 'static + Clone, NM: Map<Node<N, EI>, Key = NI> + Clone, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI> + Clone,

Source§

fn clone(&self) -> FrozenGraph<N, E, NI, EI, NM, EM>

Returns a duplicate 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<N: Debug, E: Debug, NI, EI, NM, EM> Debug for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static + Debug, EI: Copy + Eq + Debug + 'static + Debug, NM: Map<Node<N, EI>, Key = NI> + Debug, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI> + Debug,

Source§

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

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

impl<N, E, NI, EI, NM, EM> Default for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn default() -> Self

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

impl<'de, N, E, NI, EI, NM, EM> Deserialize<'de> for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static + Deserialize<'de>, EI: Copy + Eq + Debug + 'static + Deserialize<'de>, NM: Map<Node<N, EI>, Key = NI> + Deserialize<'de>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI> + Deserialize<'de>, N: Deserialize<'de>, E: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl<N, E, NI, EI, NM, EM> From<FrozenGraph<N, E, NI, EI, NM, EM>> for Graph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn from(value: FrozenGraph<N, E, NI, EI, NM, EM>) -> Self

Converts to this type from the input type.
Source§

impl<N, E, NI, EI, NM, EM> From<Graph<N, E, NI, EI, NM, EM>> for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static, EI: Copy + Eq + Debug + 'static, NM: Map<Node<N, EI>, Key = NI>, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI>,

Source§

fn from(value: Graph<N, E, NI, EI, NM, EM>) -> Self

Converts to this type from the input type.
Source§

impl<N, E, NI, EI, NM, EM> Serialize for FrozenGraph<N, E, NI, EI, NM, EM>
where NI: Copy + Eq + Debug + 'static + Serialize, EI: Copy + Eq + Debug + 'static + Serialize, NM: Map<Node<N, EI>, Key = NI> + Serialize, EM: IntKeyMap<Edge<E, NI, EI>, Key = EI> + Serialize, N: Serialize, E: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<N, E, NI, EI, NM, EM> Freeze for FrozenGraph<N, E, NI, EI, NM, EM>
where NM: Freeze, EM: Freeze,

§

impl<N, E, NI, EI, NM, EM> RefUnwindSafe for FrozenGraph<N, E, NI, EI, NM, EM>

§

impl<N, E, NI, EI, NM, EM> Send for FrozenGraph<N, E, NI, EI, NM, EM>
where NM: Send, EM: Send, N: Send, EI: Send, E: Send, NI: Send,

§

impl<N, E, NI, EI, NM, EM> Sync for FrozenGraph<N, E, NI, EI, NM, EM>
where NM: Sync, EM: Sync, N: Sync, EI: Sync, E: Sync, NI: Sync,

§

impl<N, E, NI, EI, NM, EM> Unpin for FrozenGraph<N, E, NI, EI, NM, EM>
where NM: Unpin, EM: Unpin, N: Unpin, EI: Unpin, E: Unpin, NI: Unpin,

§

impl<N, E, NI, EI, NM, EM> UnwindSafe for FrozenGraph<N, E, NI, EI, NM, EM>

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
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> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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
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.
Source§

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