Skip to main content

NonSend

Struct NonSend 

pub struct NonSend<'w, T>
where T: 'static + ?Sized,
{ /* private fields */ }
Expand description

Shared borrow of a non-Send resource.

Only Send resources may be accessed with the Res SystemParam. In case that the resource does not implement Send, this SystemParam wrapper can be used. This will instruct the scheduler to instead run the system on the main thread so that it doesn’t send the resource over to another thread.

This SystemParam fails validation if the non-send resource doesn’t exist. This will cause a panic, but can be configured to do nothing or warn once.

Use Option<NonSend<T>> instead if the resource might not always exist.

Trait Implementations§

§

impl<'w, T> AsRef<T> for NonSend<'w, T>

§

fn as_ref(&self) -> &T

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

impl<'w, T> Debug for NonSend<'w, T>
where T: Debug + ?Sized,

§

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

Formats the value using the given formatter. Read more
§

impl<'w, T> Deref for NonSend<'w, T>
where T: ?Sized,

§

type Target = T

The resulting type after dereferencing.
§

fn deref(&self) -> &<NonSend<'w, T> as Deref>::Target

Dereferences the value.
§

impl<'w, T> DetectChanges for NonSend<'w, T>
where T: ?Sized,

§

fn is_added(&self) -> bool

Returns true if this value was added after the system last ran.
§

fn is_changed(&self) -> bool

Returns true if this value was added or mutably dereferenced either since the last time the system ran or, if the system never ran, since the beginning of the program. Read more
§

fn is_added_after(&self, other: Tick) -> bool

Returns true if this value was added after the other tick.
§

fn is_changed_after(&self, other: Tick) -> bool

Returns true if this value was added or mutably dereferenced after the other tick. Read more
§

fn last_changed(&self) -> Tick

Returns the change tick recording the time this data was most recently changed. Read more
§

fn added(&self) -> Tick

Returns the change tick recording the time this data was added.
§

fn changed_by(&self) -> MaybeLocation

The location that last caused this to change.
§

impl<'w, T> From<NonSendMut<'w, T>> for NonSend<'w, T>

§

fn from(other: NonSendMut<'w, T>) -> NonSend<'w, T>

Converts to this type from the input type.
§

impl<'a, T> SystemParam for NonSend<'a, T>
where T: 'static,

§

type State = ComponentId

Used to store data which persists across invocations of a system.
§

type Item<'w, 's> = NonSend<'w, T>

The item type returned when constructing this system param. The value of this associated type should be Self, instantiated with new lifetimes. Read more
§

fn init_state(world: &mut World) -> <NonSend<'a, T> as SystemParam>::State

Creates a new instance of this param’s State.
§

fn init_access( _: &<NonSend<'a, T> as SystemParam>::State, system_meta: &mut SystemMeta, component_access_set: &mut FilteredAccessSet, _world: &mut World, )

Registers any World access used by this [SystemParam]. Read more
§

unsafe fn get_param<'w, 's>( _: &'s mut <NonSend<'a, T> as SystemParam>::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Result<<NonSend<'a, T> as SystemParam>::Item<'w, 's>, SystemParamValidationError>

Creates a parameter to be passed into a SystemParamFunction. Read more
§

fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)

Applies any deferred mutations stored in this [SystemParam]’s state. This is used to apply Commands during ApplyDeferred.
§

fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )

Queues any deferred mutations to be applied at the next ApplyDeferred.
§

impl<'w, T> ReadOnlySystemParam for NonSend<'w, T>

Auto Trait Implementations§

§

impl<'w, T> Freeze for NonSend<'w, T>
where T: ?Sized,

§

impl<'w, T> RefUnwindSafe for NonSend<'w, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'w, T> Send for NonSend<'w, T>
where T: Sync + ?Sized,

§

impl<'w, T> Sync for NonSend<'w, T>
where T: Sync + ?Sized,

§

impl<'w, T> Unpin for NonSend<'w, T>
where T: ?Sized,

§

impl<'w, T> UnsafeUnpin for NonSend<'w, T>
where T: ?Sized,

§

impl<'w, T> UnwindSafe for NonSend<'w, T>
where T: RefUnwindSafe + ?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
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> 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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> ConditionalSend for T
where T: Send,