Struct bevy::prelude::Name[]

pub struct Name { /* fields omitted */ }

Component used to identify an entity. Stores a hash for faster comparisons

Implementations

impl Name

pub fn new(name: impl Into<Cow<'static, str>>) -> Name

pub fn set(&mut self, name: impl Into<Cow<'static, str>>)

pub fn mutate<F>(&mut self, f: F) where
    F: FnOnce(&mut String), 

pub fn as_str(&self) -> &str

Methods from Deref<Target = Cow<'static, str>>

pub const fn is_borrowed(&self) -> bool[src]

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

Returns true if the data is borrowed, i.e. if to_mut would require additional work.

Examples

#![feature(cow_is_borrowed)]
use std::borrow::Cow;

let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());

let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());

pub const fn is_owned(&self) -> bool[src]

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

Returns true if the data is owned, i.e. if to_mut would be a no-op.

Examples

#![feature(cow_is_borrowed)]
use std::borrow::Cow;

let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());

let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());

Trait Implementations

impl Clone for Name

impl Debug for Name

impl Default for Name

impl Deref for Name

type Target = Cow<'static, str>

The resulting type after dereferencing.

impl Eq for Name

impl<'_> From<&'_ str> for Name

impl GetTypeRegistration for Name

impl Hash for Name

impl Ord for Name

impl PartialEq<Name> for Name

impl PartialOrd<Name> for Name

impl Reflect for Name

impl Struct for Name

Auto Trait Implementations

impl RefUnwindSafe for Name

impl Send for Name

impl Sync for Name

impl Unpin for Name

impl UnwindSafe for Name

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash + ?Sized

impl<T> CallHasher for T where
    T: Hash

impl<T> CloneAny for T where
    T: Any + Clone

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> Downcast<T> for T

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynEq for T where
    T: Any + Eq

impl<T> DynHash for T where
    T: DynEq + Hash

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

impl<T> From<T> for T[src]

impl<T> FromWorld for T where
    T: Default

impl<S> GetField for S where
    S: Struct

impl<T> GetPath for T where
    T: Reflect

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> TypeData for T where
    T: 'static + Send + Sync + Clone

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,