Skip to main content

Ptr

Struct Ptr 

Source
pub struct Ptr<E: RudaPrimitive, S: PointerSpace, A: PointerPermission = ReadOnly> { /* private fields */ }
Expand description

A logical element pointer whose storage space and permissions are part of its Rust type.

Read-only pointers cannot store:

ⓘ
use ruda_kernel::dsl::prelude::{GlobalSpace, Ptr};
fn write(pointer: Ptr<f32, GlobalSpace>) { pointer.store(1.0); }

Address spaces cannot be interchanged:

ⓘ
use ruda_kernel::dsl::prelude::{GlobalSpace, Ptr, Workgroup};
fn global(_: Ptr<f32, GlobalSpace>) {}
fn shared(pointer: Ptr<f32, Workgroup>) { global(pointer); }

Read-only permissions cannot be upgraded:

ⓘ
use ruda_kernel::dsl::prelude::{GlobalSpace, Ptr, ReadWrite};
fn upgrade(pointer: Ptr<f32, GlobalSpace>) -> Ptr<f32, GlobalSpace, ReadWrite> { pointer }

Implementations§

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> Ptr<E, S, A>

Source

pub fn value(&self) -> ValuePtr<E, S, A>

Materialize a pointer value that can be reassigned and carried across branches and loops.

Source

pub fn offset(&self, offset: usize) -> Self

Source

pub fn read_only(&self) -> Ptr<E, S, ReadOnly>

Source

pub fn select(&self, condition: bool, otherwise: Self) -> Self

Source

pub fn load(&self) -> E

Source

pub fn __expand_value( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <ValuePtr<E, S, A> as RudaType>::ExpandType

Source

pub fn __expand_offset( scope: &mut Scope, this: <Self as RudaType>::ExpandType, offset: <usize as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType

Source

pub fn __expand_read_only( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <Ptr<E, S, ReadOnly> as RudaType>::ExpandType

Source

pub fn __expand_select( scope: &mut Scope, this: <Self as RudaType>::ExpandType, condition: <bool as RudaType>::ExpandType, otherwise: <Self as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType

Source

pub fn __expand_load( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType

Source§

impl<E: RudaPrimitive, S: PointerSpace> Ptr<E, S, ReadWrite>

Source

pub fn store(&self, value: E)

Source

pub fn __expand_store( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType

Trait Implementations§

Source§

impl<E: Clone + RudaPrimitive, S: Clone + PointerSpace, A: Clone + PointerPermission> Clone for Ptr<E, S, A>

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<E: Copy + RudaPrimitive, S: Copy + PointerSpace, A: Copy + PointerPermission> Copy for Ptr<E, S, A>

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for Ptr<E, S, A>

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &Ptr<E, S, A>

Auto Trait Implementations§

§

impl<E, S, A> Freeze for Ptr<E, S, A>

§

impl<E, S, A> RefUnwindSafe for Ptr<E, S, A>

§

impl<E, S, A> Send for Ptr<E, S, A>

§

impl<E, S, A> Sync for Ptr<E, S, A>

§

impl<E, S, A> Unpin for Ptr<E, S, A>

§

impl<E, S, A> UnsafeUnpin for Ptr<E, S, A>

§

impl<E, S, A> UnwindSafe for Ptr<E, S, A>

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<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

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

Source§

fn comptime(self) -> Self

Source§

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

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.