Struct bevy::utils::petgraph::matrix_graph::MatrixGraph
source · pub struct MatrixGraph<N, E, Ty = Directed, Null = Option<E>, Ix = u16>where
Null: Nullable<Wrapped = E>,{ /* private fields */ }
Expand description
MatrixGraph<N, E, Ty, Null>
is a graph datastructure using an adjacency matrix
representation.
MatrixGraph
is parameterized over:
- Associated data
N
for nodes andE
for edges, called weights. The associated data can be of arbitrary type. - Edge type
Ty
that determines whether the graph edges are directed or undirected. - Nullable type
Null
, which denotes the edges’ presence (defaults toOption<E>
). You may specifyNotZero<E>
if you want to use a sentinel value (such as 0) to mark the absence of an edge. - Index type
Ix
that sets the maximum size for the graph (defaults toDefaultIx
).
The graph uses O(|V^2|) space, with fast edge insertion & amortized node insertion, as well as efficient graph search and graph algorithms on dense graphs.
This graph is backed by a flattened 2D array. For undirected graphs, only the lower triangular matrix is stored. Since the backing array stores edge weights, it is recommended to box large edge weights.
Implementations§
source§impl<N, E, Ty, Null, Ix> MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> MatrixGraph<N, E, Ty, Null, Ix>
sourcepub fn with_capacity(node_capacity: usize) -> MatrixGraph<N, E, Ty, Null, Ix>
pub fn with_capacity(node_capacity: usize) -> MatrixGraph<N, E, Ty, Null, Ix>
Create a new MatrixGraph
with estimated capacity for nodes.
sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes (vertices) in the graph.
Computes in O(1) time.
sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Return the number of edges in the graph.
Computes in O(1) time.
sourcepub fn is_directed(&self) -> bool
pub fn is_directed(&self) -> bool
Return whether the graph has directed edges or not.
sourcepub fn add_node(&mut self, weight: N) -> NodeIndex<Ix>
pub fn add_node(&mut self, weight: N) -> NodeIndex<Ix>
Add a node (also called vertex) with associated data weight
to the graph.
Computes in O(1) time.
Return the index of the new node.
Panics if the MatrixGraph is at the maximum number of nodes for its index type.
sourcepub fn remove_node(&mut self, a: NodeIndex<Ix>) -> N
pub fn remove_node(&mut self, a: NodeIndex<Ix>) -> N
Remove a
from the graph.
Computes in O(V) time, due to the removal of edges with other nodes.
Panics if the node a
does not exist.
sourcepub fn update_edge(
&mut self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>,
weight: E
) -> Option<E>
pub fn update_edge( &mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E ) -> Option<E>
Update the edge from a
to b
to the graph, with its associated data weight
.
Return the previous data, if any.
Computes in O(1) time, best case. Computes in O(|V|^2) time, worst case (matrix needs to be re-allocated).
Panics if any of the nodes don’t exist.
sourcepub fn add_edge(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E)
pub fn add_edge(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>, weight: E)
Add an edge from a
to b
to the graph, with its associated
data weight
.
Computes in O(1) time, best case. Computes in O(|V|^2) time, worst case (matrix needs to be re-allocated).
Panics if any of the nodes don’t exist.
Panics if an edge already exists from a
to b
.
Note: MatrixGraph
does not allow adding parallel (“duplicate”) edges. If you want to avoid
this, use .update_edge(a, b, weight)
instead.
sourcepub fn remove_edge(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> E
pub fn remove_edge(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> E
Remove the edge from a
to b
to the graph.
Panics if any of the nodes don’t exist.
Panics if no edge exists between a
and b
.
sourcepub fn has_edge(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> bool
pub fn has_edge(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> bool
Return true if there is an edge between a
and b
.
Panics if any of the nodes don’t exist.
sourcepub fn node_weight(&self, a: NodeIndex<Ix>) -> &N
pub fn node_weight(&self, a: NodeIndex<Ix>) -> &N
Access the weight for node a
.
Also available with indexing syntax: &graph[a]
.
Panics if the node doesn’t exist.
sourcepub fn node_weight_mut(&mut self, a: NodeIndex<Ix>) -> &mut N
pub fn node_weight_mut(&mut self, a: NodeIndex<Ix>) -> &mut N
Access the weight for node a
, mutably.
Also available with indexing syntax: &mut graph[a]
.
Panics if the node doesn’t exist.
sourcepub fn edge_weight(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> &E
pub fn edge_weight(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> &E
Access the weight for edge e
.
Also available with indexing syntax: &graph[e]
.
Panics if no edge exists between a
and b
.
sourcepub fn edge_weight_mut(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> &mut E
pub fn edge_weight_mut(&mut self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> &mut E
Access the weight for edge e
, mutably.
Also available with indexing syntax: &mut graph[e]
.
Panics if no edge exists between a
and b
.
sourcepub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, Ty, Null, Ix> ⓘ
pub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, Ty, Null, Ix> ⓘ
Return an iterator of all nodes with an edge starting from a
.
Directed
: Outgoing edges froma
.Undirected
: All edges from or toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is NodeIndex<Ix>
.
sourcepub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, Ty, Null, Ix> ⓘ
pub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, Ty, Null, Ix> ⓘ
Return an iterator of all edges of a
.
Directed
: Outgoing edges froma
.Undirected
: All edges connected toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is (NodeIndex<Ix>, NodeIndex<Ix>, &E)
.
sourcepub fn from_edges<I>(iterable: I) -> MatrixGraph<N, E, Ty, Null, Ix>where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,
pub fn from_edges<I>(iterable: I) -> MatrixGraph<N, E, Ty, Null, Ix>where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,
Create a new MatrixGraph
from an iterable of edges.
Node weights N
are set to default values.
Edge weights E
may either be specified in the list,
or they are filled with default values.
Nodes are inserted automatically to match the edges.
use petgraph::matrix_graph::MatrixGraph;
let gr = MatrixGraph::<(), i32>::from_edges(&[
(0, 1), (0, 2), (0, 3),
(1, 2), (1, 3),
(2, 3),
]);
sourcepub fn extend_with_edges<I>(&mut self, iterable: I)where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,
pub fn extend_with_edges<I>(&mut self, iterable: I)where
I: IntoIterator,
<I as IntoIterator>::Item: IntoWeightedEdge<E>,
<<I as IntoIterator>::Item as IntoWeightedEdge<E>>::NodeId: Into<NodeIndex<Ix>>,
N: Default,
Extend the graph from an iterable of edges.
Node weights N
are set to default values.
Edge weights E
may either be specified in the list,
or they are filled with default values.
Nodes are inserted automatically to match the edges.
source§impl<N, E, Null, Ix> MatrixGraph<N, E, Directed, Null, Ix>
impl<N, E, Null, Ix> MatrixGraph<N, E, Directed, Null, Ix>
sourcepub fn neighbors_directed(
&self,
a: NodeIndex<Ix>,
d: Direction
) -> Neighbors<'_, Directed, Null, Ix> ⓘ
pub fn neighbors_directed( &self, a: NodeIndex<Ix>, d: Direction ) -> Neighbors<'_, Directed, Null, Ix> ⓘ
Return an iterator of all neighbors that have an edge between them and
a
, in the specified direction.
If the graph’s edges are undirected, this is equivalent to .neighbors(a).
Outgoing
: All edges froma
.Incoming
: All edges toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is NodeIndex<Ix>
.
sourcepub fn edges_directed(
&self,
a: NodeIndex<Ix>,
d: Direction
) -> Edges<'_, Directed, Null, Ix> ⓘ
pub fn edges_directed( &self, a: NodeIndex<Ix>, d: Direction ) -> Edges<'_, Directed, Null, Ix> ⓘ
Return an iterator of all edges of a
, in the specified direction.
Outgoing
: All edges froma
.Incoming
: All edges toa
.
Produces an empty iterator if the node a
doesn’t exist.
Iterator element type is (NodeIndex<Ix>, NodeIndex<Ix>, &E)
.
source§impl<N, E> MatrixGraph<N, E>
impl<N, E> MatrixGraph<N, E>
sourcepub fn new() -> MatrixGraph<N, E>
pub fn new() -> MatrixGraph<N, E>
Create a new MatrixGraph
with directed edges.
This is a convenience method. Use MatrixGraph::with_capacity
or MatrixGraph::default
for
a constructor that is generic in all the type parameters of MatrixGraph
.
source§impl<N, E> MatrixGraph<N, E, Undirected>
impl<N, E> MatrixGraph<N, E, Undirected>
sourcepub fn new_undirected() -> MatrixGraph<N, E, Undirected>
pub fn new_undirected() -> MatrixGraph<N, E, Undirected>
Create a new MatrixGraph
with undirected edges.
This is a convenience method. Use MatrixGraph::with_capacity
or MatrixGraph::default
for
a constructor that is generic in all the type parameters of MatrixGraph
.
Trait Implementations§
source§impl<N, E, Ty, Null, Ix> Build for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Build for MatrixGraph<N, E, Ty, Null, Ix>
fn add_node( &mut self, weight: <MatrixGraph<N, E, Ty, Null, Ix> as Data>::NodeWeight ) -> <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId
source§fn add_edge(
&mut self,
a: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId,
b: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId,
weight: <MatrixGraph<N, E, Ty, Null, Ix> as Data>::EdgeWeight
) -> Option<<MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::EdgeId>
fn add_edge( &mut self, a: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId, b: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId, weight: <MatrixGraph<N, E, Ty, Null, Ix> as Data>::EdgeWeight ) -> Option<<MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::EdgeId>
None
.source§fn update_edge(
&mut self,
a: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId,
b: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId,
weight: <MatrixGraph<N, E, Ty, Null, Ix> as Data>::EdgeWeight
) -> <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::EdgeId
fn update_edge( &mut self, a: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId, b: <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId, weight: <MatrixGraph<N, E, Ty, Null, Ix> as Data>::EdgeWeight ) -> <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::EdgeId
a
to b
. Return the id of the affected
edge.source§impl<N, E, Ty, Null, Ix> Clone for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Clone for MatrixGraph<N, E, Ty, Null, Ix>
source§fn clone(&self) -> MatrixGraph<N, E, Ty, Null, Ix>
fn clone(&self) -> MatrixGraph<N, E, Ty, Null, Ix>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<N, E, Ty, Null, Ix> Data for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Data for MatrixGraph<N, E, Ty, Null, Ix>
type NodeWeight = N
type EdgeWeight = E
source§impl<N, E, Ty, Null, Ix> Default for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Default for MatrixGraph<N, E, Ty, Null, Ix>
Create a new empty MatrixGraph
.
source§fn default() -> MatrixGraph<N, E, Ty, Null, Ix>
fn default() -> MatrixGraph<N, E, Ty, Null, Ix>
source§impl<N, E, Ty, Null, Ix> EdgeCount for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> EdgeCount for MatrixGraph<N, E, Ty, Null, Ix>
source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
source§impl<N, E, Ty, Null, Ix> GetAdjacencyMatrix for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> GetAdjacencyMatrix for MatrixGraph<N, E, Ty, Null, Ix>
source§fn adjacency_matrix(
&self
) -> <MatrixGraph<N, E, Ty, Null, Ix> as GetAdjacencyMatrix>::AdjMatrix
fn adjacency_matrix( &self ) -> <MatrixGraph<N, E, Ty, Null, Ix> as GetAdjacencyMatrix>::AdjMatrix
source§fn is_adjacent(
&self,
_: &<MatrixGraph<N, E, Ty, Null, Ix> as GetAdjacencyMatrix>::AdjMatrix,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> bool
fn is_adjacent( &self, _: &<MatrixGraph<N, E, Ty, Null, Ix> as GetAdjacencyMatrix>::AdjMatrix, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> bool
source§impl<N, E, Ty, Null, Ix> GraphBase for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> GraphBase for MatrixGraph<N, E, Ty, Null, Ix>
source§impl<N, E, Ty, Null, Ix> GraphProp for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> GraphProp for MatrixGraph<N, E, Ty, Null, Ix>
source§impl<N, E, Ty, Null, Ix> Index<(NodeIndex<Ix>, NodeIndex<Ix>)> for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Index<(NodeIndex<Ix>, NodeIndex<Ix>)> for MatrixGraph<N, E, Ty, Null, Ix>
Index the MatrixGraph
by NodeIndex
pair to access edge weights.
Also available with indexing syntax: &graph[e]
.
Panics if no edge exists between a
and b
.
source§impl<N, E, Ty, Null, Ix> Index<NodeIndex<Ix>> for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Index<NodeIndex<Ix>> for MatrixGraph<N, E, Ty, Null, Ix>
Index the MatrixGraph
by NodeIndex
to access node weights.
Panics if the node doesn’t exist.
source§impl<N, E, Ty, Null, Ix> IndexMut<(NodeIndex<Ix>, NodeIndex<Ix>)> for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> IndexMut<(NodeIndex<Ix>, NodeIndex<Ix>)> for MatrixGraph<N, E, Ty, Null, Ix>
Index the MatrixGraph
by NodeIndex
pair to access edge weights.
Also available with indexing syntax: &mut graph[e]
.
Panics if no edge exists between a
and b
.
source§impl<N, E, Ty, Null, Ix> IndexMut<NodeIndex<Ix>> for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> IndexMut<NodeIndex<Ix>> for MatrixGraph<N, E, Ty, Null, Ix>
Index the MatrixGraph
by NodeIndex
to access node weights.
Panics if the node doesn’t exist.
source§impl<'a, N, E, Ty, Null, Ix> IntoEdgeReferences for &'a MatrixGraph<N, E, Ty, Null, Ix>
impl<'a, N, E, Ty, Null, Ix> IntoEdgeReferences for &'a MatrixGraph<N, E, Ty, Null, Ix>
type EdgeRef = (NodeIndex<Ix>, NodeIndex<Ix>, &'a E)
type EdgeReferences = EdgeReferences<'a, Ty, Null, Ix>
fn edge_references( self ) -> <&'a MatrixGraph<N, E, Ty, Null, Ix> as IntoEdgeReferences>::EdgeReferences
source§impl<'a, N, E, Ty, Null, Ix> IntoEdges for &'a MatrixGraph<N, E, Ty, Null, Ix>
impl<'a, N, E, Ty, Null, Ix> IntoEdges for &'a MatrixGraph<N, E, Ty, Null, Ix>
source§impl<'a, N, E, Null, Ix> IntoEdgesDirected for &'a MatrixGraph<N, E, Directed, Null, Ix>
impl<'a, N, E, Null, Ix> IntoEdgesDirected for &'a MatrixGraph<N, E, Directed, Null, Ix>
type EdgesDirected = Edges<'a, Directed, Null, Ix>
fn edges_directed( self, a: <&'a MatrixGraph<N, E, Directed, Null, Ix> as GraphBase>::NodeId, dir: Direction ) -> <&'a MatrixGraph<N, E, Directed, Null, Ix> as IntoEdgesDirected>::EdgesDirected
source§impl<'a, N, E, Ty, Null, Ix> IntoNeighbors for &'a MatrixGraph<N, E, Ty, Null, Ix>
impl<'a, N, E, Ty, Null, Ix> IntoNeighbors for &'a MatrixGraph<N, E, Ty, Null, Ix>
type Neighbors = Neighbors<'a, Ty, Null, Ix>
source§fn neighbors(
self,
a: NodeIndex<Ix>
) -> <&'a MatrixGraph<N, E, Ty, Null, Ix> as IntoNeighbors>::Neighbors
fn neighbors( self, a: NodeIndex<Ix> ) -> <&'a MatrixGraph<N, E, Ty, Null, Ix> as IntoNeighbors>::Neighbors
a
.source§impl<'a, N, E, Null, Ix> IntoNeighborsDirected for &'a MatrixGraph<N, E, Directed, Null, Ix>
impl<'a, N, E, Null, Ix> IntoNeighborsDirected for &'a MatrixGraph<N, E, Directed, Null, Ix>
type NeighborsDirected = Neighbors<'a, Directed, Null, Ix>
fn neighbors_directed( self, a: NodeIndex<Ix>, d: Direction ) -> <&'a MatrixGraph<N, E, Directed, Null, Ix> as IntoNeighborsDirected>::NeighborsDirected
source§impl<'a, N, E, Ty, Null, Ix> IntoNodeIdentifiers for &'a MatrixGraph<N, E, Ty, Null, Ix>
impl<'a, N, E, Ty, Null, Ix> IntoNodeIdentifiers for &'a MatrixGraph<N, E, Ty, Null, Ix>
type NodeIdentifiers = NodeIdentifiers<'a, Ix>
fn node_identifiers( self ) -> <&'a MatrixGraph<N, E, Ty, Null, Ix> as IntoNodeIdentifiers>::NodeIdentifiers
source§impl<'a, N, E, Ty, Null, Ix> IntoNodeReferences for &'a MatrixGraph<N, E, Ty, Null, Ix>
impl<'a, N, E, Ty, Null, Ix> IntoNodeReferences for &'a MatrixGraph<N, E, Ty, Null, Ix>
type NodeRef = (NodeIndex<Ix>, &'a N)
type NodeReferences = NodeReferences<'a, N, Ix>
fn node_references( self ) -> <&'a MatrixGraph<N, E, Ty, Null, Ix> as IntoNodeReferences>::NodeReferences
source§impl<N, E, Ty, Null, Ix> NodeCount for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> NodeCount for MatrixGraph<N, E, Ty, Null, Ix>
fn node_count(&self) -> usize
source§impl<N, E, Ty, Null, Ix> NodeIndexable for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> NodeIndexable for MatrixGraph<N, E, Ty, Null, Ix>
source§fn node_bound(&self) -> usize
fn node_bound(&self) -> usize
source§fn from_index(
&self,
ix: usize
) -> <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId
fn from_index( &self, ix: usize ) -> <MatrixGraph<N, E, Ty, Null, Ix> as GraphBase>::NodeId
i
to a node index. i
must be a valid value in the graph.source§impl<N, E, Ty, Null, Ix> Visitable for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Visitable for MatrixGraph<N, E, Ty, Null, Ix>
§type Map = FixedBitSet
type Map = FixedBitSet
source§fn visit_map(&self) -> FixedBitSet
fn visit_map(&self) -> FixedBitSet
Auto Trait Implementations§
impl<N, E, Ty, Null, Ix> RefUnwindSafe for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Send for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Sync for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> Unpin for MatrixGraph<N, E, Ty, Null, Ix>
impl<N, E, Ty, Null, Ix> UnwindSafe for MatrixGraph<N, E, Ty, Null, Ix>
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.