Skip to main content

FetchComponent

Trait FetchComponent 

Source
pub trait FetchComponent {
    type Component: 'static;
    type Fetch<'w>: Copy;
    type Item<'w>;
    type Slice<'w>;

    const IS_MUT: bool;

    // Required methods
    unsafe fn fetch_raw<'w>(
        arch: &Archetype,
        system_tick: u32,
    ) -> Option<Self::Fetch<'w>>;
    unsafe fn get_item<'w>(fetch: Self::Fetch<'w>, row: usize) -> Self::Item<'w>;
    unsafe fn get_slice<'w>(
        fetch: Self::Fetch<'w>,
        len: usize,
    ) -> Self::Slice<'w>;
}

Required Associated Constants§

Required Associated Types§

Source

type Component: 'static

Source

type Fetch<'w>: Copy

Source

type Item<'w>

Source

type Slice<'w>

Required Methods§

Source

unsafe fn fetch_raw<'w>( arch: &Archetype, system_tick: u32, ) -> Option<Self::Fetch<'w>>

Bir archetype bazında ham pointer fetch hazırlar.

Source

unsafe fn get_item<'w>(fetch: Self::Fetch<'w>, row: usize) -> Self::Item<'w>

Ham pointer’dan veriyi getirir.

Source

unsafe fn get_slice<'w>(fetch: Self::Fetch<'w>, len: usize) -> Self::Slice<'w>

Chunk olarak ardışık belleği Slice şeklinde getirir (SIMD).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: 'static> FetchComponent for &T

Source§

const IS_MUT: bool = false

Source§

type Component = T

Source§

type Fetch<'w> = *const u8

Source§

type Item<'w> = &'w T

Source§

type Slice<'w> = &'w [T]

Source§

unsafe fn fetch_raw<'w>( arch: &Archetype, _system_tick: u32, ) -> Option<Self::Fetch<'w>>

Source§

unsafe fn get_item<'w>(fetch: Self::Fetch<'w>, row: usize) -> Self::Item<'w>

Source§

unsafe fn get_slice<'w>(fetch: Self::Fetch<'w>, len: usize) -> Self::Slice<'w>

Implementors§

Source§

impl<T: 'static> FetchComponent for Mut<'_, T>

Source§

const IS_MUT: bool = true

Source§

type Component = T

Source§

type Fetch<'w> = (*mut u8, *mut ComponentTicks, u32)

Source§

type Item<'w> = Mut<'w, T>

Source§

type Slice<'w> = &'w mut [T]