Struct ThreadStack

Source
#[repr(C)]
pub struct ThreadStack<const SIZE: usize> { pub data: UnsafeCell<[z_thread_stack_element; SIZE]>, /* private fields */ }
Expand description

A Zephyr stack declaration.

This isn’t intended to be used directly, as it needs additional decoration about linker sections and such. Unlike the C declaration, the reservation is a separate field. As long as the SIZE is properly aligned, this should work without padding between the fields.

Generally, this should be placed in a noinit linker section to avoid having to initialize the memory.

Fields§

§data: UnsafeCell<[z_thread_stack_element; SIZE]>

The data of the stack itself.

Implementations§

Source§

impl<const SIZE: usize> ThreadStack<SIZE>

Source

pub const fn new() -> Self

Construct a new ThreadStack

§Safety

This is unsafe as the memory remains uninitialized, and it is the responsibility of the caller to use the stack correctly. The stack should be associated with a single thread.

Source

pub const fn size(&self) -> usize

Retrieve the size of this stack.

Trait Implementations§

Source§

impl<const SIZE: usize> Sync for ThreadStack<SIZE>

Auto Trait Implementations§

§

impl<const SIZE: usize> !Freeze for ThreadStack<SIZE>

§

impl<const SIZE: usize> !RefUnwindSafe for ThreadStack<SIZE>

§

impl<const SIZE: usize> Send for ThreadStack<SIZE>

§

impl<const SIZE: usize> Unpin for ThreadStack<SIZE>

§

impl<const SIZE: usize> UnwindSafe for ThreadStack<SIZE>

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.

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.