Struct Builder

Source
pub struct Builder<'a> { /* private fields */ }
Expand description

A structure used to create a Stadium. This function can be created using the stadium::builder function.

Implementations§

Source§

impl<'a> Builder<'a>

Source

pub fn new() -> Self

Creates a new instance of Builder.

§Examples
let builder = stadium::Builder::new();
// That it! Now you have your own builder.
Source

pub fn insert<T: 'a>(&mut self, init: T) -> Handle<T>

Prepares the insertion of init into the Stadium.

§Panics

This function panics if it fails to allocate a box for init.

Source

pub fn insert_raw(&mut self, meta: ObjectMeta) -> RawHandle

Prepares the insertion of a MaybeUninit<T> into the Stadium where T is the type described by the given ObjectMeta structure.

Source

pub fn insert_uninit<T>(&mut self) -> Handle<MaybeUninit<T>>

Prepares the insertion of a MaybeUninit<T> into the Stadium.

Source

pub unsafe fn insert_zeroed_raw(&mut self, meta: ObjectMeta) -> RawHandle

Prepares the insertion of a T into the Stadium where T is the type described by the given ObjectMeta structure.

§Safety

T must be safely created using mem::zeroed().

Source

pub unsafe fn insert_zeroed<T>(&mut self) -> Handle<T>

Prepares the insertion of a T into the Stadium.

§Safety

T must be safely created using mem::zeroed().

Source

pub fn insert_default<T: Default>(&mut self) -> Handle<T>

Prepares the insertion of a T into the Stadium. The T will be automatically initialized to its default value.

Source

pub fn build(self) -> Stadium<'a>

Builds a new Stadium.

§Panics

This function can panics if one of the following events occure:

  • The builder is empty
  • The function fails to allocate for the stadium

Trait Implementations§

Source§

impl<'a> From<Builder<'a>> for Stadium<'a>

Source§

fn from(builder: Builder<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Builder<'a>

§

impl<'a> RefUnwindSafe for Builder<'a>

§

impl<'a> !Send for Builder<'a>

§

impl<'a> !Sync for Builder<'a>

§

impl<'a> Unpin for Builder<'a>

§

impl<'a> UnwindSafe for Builder<'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<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.