Skip to main content

Shared

Struct Shared 

Source
pub struct Shared<E: NativeCubeType + ?Sized> { /* private fields */ }

Implementations§

Source§

impl<T: CubePrimitive> Shared<[T]>

Source

pub fn new_slice(len: usize) -> Self

Create a new shared slice.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source

pub fn new_aligned_slice(len: usize, alignment: usize) -> Self

Create a new shared slice with a specified minimum alignment.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source

pub fn len(&self) -> usize

Source

pub fn __expand_new_slice( scope: &Scope, len: usize, ) -> <Self as CubeType>::ExpandType

Create a new shared slice.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source

pub fn __expand_new_aligned_slice( scope: &Scope, len: usize, alignment: usize, ) -> <Self as CubeType>::ExpandType

Create a new shared slice with a specified minimum alignment.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source

pub fn __expand_len( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <usize as CubeType>::ExpandType

Source§

impl<T: NativeCubeType + ?Sized> Shared<T>

Source

pub fn map<U: NativeCubeType + ?Sized>( self, _map: impl FnOnce(&T) -> &U, ) -> Shared<U>

Source§

impl<T: CubePrimitive> Shared<T>

Source

pub fn new() -> Self

Create a new shared object.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source

pub fn __expand_new(scope: &Scope) -> <Self as CubeType>::ExpandType

Create a new shared object.

§Safety

Shared memory is always uninitialized by default. Reading uninitialized shared values is undefined behavior.

Source§

impl<T: NativeCubeType + ?Sized> Shared<T>

Source

pub fn inner_ref(&self) -> &T

Source

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

Source

pub fn __expand_inner_ref<'infer, 'scope>( scope: &'scope Scope, this: &'infer <Self as CubeType>::ExpandType, ) -> &'infer <T as CubeType>::ExpandType

Source

pub fn __expand_inner_mut<'infer, 'scope>( scope: &'scope Scope, this: &'infer mut <Self as CubeType>::ExpandType, ) -> &'infer mut <T as CubeType>::ExpandType

Source§

impl<T: CubePrimitive> Shared<T>

Source

pub fn __expand_default(scope: &Scope) -> <Self as CubeType>::ExpandType

Source§

impl<T: NativeCubeType + ?Sized> Shared<T>

Source

pub unsafe fn free(&self)

Frees the shared memory for reuse, if possible on the target runtime.

§Safety

Must be used in uniform control flow Must not have any dangling references to this shared memory

Source

pub fn __expand_free(scope: &Scope, this: &<Self as CubeType>::ExpandType)

Frees the shared memory for reuse, if possible on the target runtime.

§Safety

Must be used in uniform control flow Must not have any dangling references to this shared memory

Source§

impl<E: CubePrimitive> Shared<[E]>

Source

pub fn as_slice(&self) -> &[E]

Source

pub fn as_mut_slice(&mut self) -> &mut [E]

Source

pub fn __expand_as_slice<'infer, 'scope>( scope: &'scope Scope, this: &'infer <Self as CubeType>::ExpandType, ) -> &'infer <[E] as CubeType>::ExpandType

Source

pub fn __expand_as_mut_slice<'infer, 'scope>( scope: &'scope Scope, this: &'infer mut <Self as CubeType>::ExpandType, ) -> &'infer mut <[E] as CubeType>::ExpandType

Trait Implementations§

Source§

impl<E: NativeCubeType + ?Sized> Clone for Shared<E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: NativeCubeType + ?Sized> CubeType for Shared<T>

Source§

impl<T: CubePrimitive> Default for Shared<T>

Source§

fn default() -> Self

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

impl<T: NativeCubeType + ?Sized> Deref for Shared<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: NativeCubeType + ?Sized> DerefMut for Shared<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<E: CubePrimitive> Index<Range<usize>> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<RangeFrom<usize>> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<RangeFull> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: RangeFull) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<RangeInclusive<usize>> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: RangeInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<RangeTo<usize>> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<RangeToInclusive<usize>> for Shared<[E]>

Source§

type Output = [E]

The returned type after indexing.
Source§

fn index(&self, _idx: RangeToInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> Index<usize> for Shared<[E]>

Source§

type Output = E

The returned type after indexing.
Source§

fn index(&self, _idx: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<Range<usize>> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<RangeFrom<usize>> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: RangeFrom<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<RangeFull> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: RangeFull) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<RangeInclusive<usize>> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: RangeInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<RangeTo<usize>> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: RangeTo<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<RangeToInclusive<usize>> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: RangeToInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<E: CubePrimitive> IndexMut<usize> for Shared<[E]>

Source§

fn index_mut(&mut self, _idx: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: CubePrimitive> List<T> for Shared<[T]>

Source§

fn len(&self) -> usize

Source§

fn __expand_len( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <usize as CubeType>::ExpandType

Source§

impl<E: CubePrimitive> SliceOperator<E> for Shared<[E]>

Source§

fn slice(&self, start: usize, end: usize) -> &[E]

Return a read-only view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn slice_mut(&mut self, start: usize, end: usize) -> &mut [E]

Return a read-write view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn __expand_slice<'infer, 'scope>( scope: &'scope Scope, this: &'infer <Self as CubeType>::ExpandType, start: <usize as CubeType>::ExpandType, end: <usize as CubeType>::ExpandType, ) -> &'infer <[E] as CubeType>::ExpandType

Source§

fn __expand_slice_mut<'infer, 'scope>( scope: &'scope Scope, this: &'infer mut <Self as CubeType>::ExpandType, start: <usize as CubeType>::ExpandType, end: <usize as CubeType>::ExpandType, ) -> &'infer mut <[E] as CubeType>::ExpandType

Source§

impl<T: CubePrimitive> Vectorized for Shared<[T]>

Auto Trait Implementations§

§

impl<E> !Send for Shared<E>

§

impl<E> !Sync for Shared<E>

§

impl<E> Freeze for Shared<E>
where E: ?Sized,

§

impl<E> RefUnwindSafe for Shared<E>
where E: RefUnwindSafe + ?Sized,

§

impl<E> Unpin for Shared<E>
where E: ?Sized,

§

impl<E> UnsafeUnpin for Shared<E>
where E: ?Sized,

§

impl<E> UnwindSafe for Shared<E>
where E: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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<R> CryptoRng for R
where R: TryCryptoRng<Error = Infallible> + ?Sized,

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> IntoComptime for T

Source§

fn comptime(self) -> Self

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> NativeCubeType for T
where T: CubeType<ExpandType = NativeExpand<T>> + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<R> Rng for R
where R: TryRng<Error = Infallible> + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32.
Source§

fn next_u64(&mut self) -> u64

Return the next random u64.
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<R> RngCore for R
where R: Rng,

Source§

impl<R> RngExt for R
where R: Rng + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where D: Distribution<T>,

Sample a new value, using the given distribution. Read more
Source§

fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>
where D: Distribution<T>, Self: Sized,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut [T])
where T: Fill,

Fill any type implementing Fill with random data 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<R> TryCryptoRng for R
where R: DerefMut, <R as Deref>::Target: TryCryptoRng,

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<R> TryRng for R
where R: DerefMut, <R as Deref>::Target: TryRng,

Source§

type Error = <<R as Deref>::Target as TryRng>::Error

The type returned in the event of a RNG error. Read more
Source§

fn try_next_u32(&mut self) -> Result<u32, <R as TryRng>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRng>::Error>

Return the next random u64.
Source§

fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), <R as TryRng>::Error>

Fill dst entirely with random data.
Source§

impl<R> TryRngCore for R
where R: TryRng,

Source§

type Error = <R as TryRng>::Error

👎Deprecated since 0.10.0:

use TryRng instead

Error type.