Skip to main content

CommandStreamDraft

Struct CommandStreamDraft 

Source
pub struct CommandStreamDraft<A = ()> {
    pub args: A,
    /* private fields */
}
Expand description

A finalized command stream definition that can be prepared later.

Drafts are useful when construction should happen separately from preparation. Convert a draft with CommandStreamDraft::into_stream for unprepared insertion or CommandStreamDraft::prepare to cache preparation work.

let draft = CommandStream::finalize(|stream| {
    stream.begin_cmd().record_cmd(|_| {});
});

let prepared = draft.prepare(&mut pool)?;
let mut graph = Graph::new();
graph.insert_cmd_stream(&prepared).finish();

Fields§

§args: A

Typed handles returned by the finalization callback.

Implementations§

Source§

impl<A> CommandStreamDraft<A>

Source

pub fn into_stream(self) -> CommandStream<A>

Converts this draft into a command stream without preparing optimizations.

Unprepared streams avoid preparation cost until insertion, but they do not cache the prepared schedule or static recording resources.

Source

pub fn prepare<P>(self, pool: &mut P) -> Result<CommandStream<A>, DriverError>
where P: SubmissionPool,

Prepares this stream by optimizing its finalized graph and leasing static recording resources for the prepared schedule.

This is most useful when the same stream is inserted many times with different arguments.

Trait Implementations§

Source§

impl<A: Debug> Debug for CommandStreamDraft<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A = ()> !Freeze for CommandStreamDraft<A>

§

impl<A> RefUnwindSafe for CommandStreamDraft<A>
where A: RefUnwindSafe,

§

impl<A> Send for CommandStreamDraft<A>
where A: Send,

§

impl<A> Sync for CommandStreamDraft<A>
where A: Sync,

§

impl<A> Unpin for CommandStreamDraft<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for CommandStreamDraft<A>
where A: UnsafeUnpin,

§

impl<A> UnwindSafe for CommandStreamDraft<A>
where A: UnwindSafe,

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<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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.