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>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> Ptr<E, S, A>
Sourcepub fn value(&self) -> ValuePtr<E, S, A>
pub fn value(&self) -> ValuePtr<E, S, A>
Materialize a pointer value that can be reassigned and carried across branches and loops.
pub fn offset(&self, offset: usize) -> Self
pub fn read_only(&self) -> Ptr<E, S, ReadOnly>
pub fn select(&self, condition: bool, otherwise: Self) -> Self
pub fn load(&self) -> E
pub fn __expand_value( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <ValuePtr<E, S, A> as RudaType>::ExpandType
pub fn __expand_offset( scope: &mut Scope, this: <Self as RudaType>::ExpandType, offset: <usize as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType
pub fn __expand_read_only( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <Ptr<E, S, ReadOnly> as RudaType>::ExpandType
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
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>
impl<E: RudaPrimitive, S: PointerSpace> Ptr<E, S, ReadWrite>
pub fn store(&self, value: E)
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>
impl<E: Clone + RudaPrimitive, S: Clone + PointerSpace, A: Clone + PointerPermission> Clone for Ptr<E, S, A>
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>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for Ptr<E, S, A>
type ExpandType = PtrExpand<E, S, A>
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &Ptr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &Ptr<E, S, A>
type ExpandType = PtrExpand<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> 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
Mutably borrows from an owned value. Read more