pub struct BindingInstanceBuilder<T> { /* private fields */ }Expand description
Builds a BindingInstance<T>. Start from new, chain
the per-kind binding methods below (mirroring how BindGroupBuilder
adds one resource per call), then finish with
build/build_asset. See the
MaterialInstanceBuilder/ComputeInstanceBuilder aliases for the
two concrete instantiations.
Implementations§
Source§impl<T> BindingInstanceBuilder<T>
impl<T> BindingInstanceBuilder<T>
Sourcepub fn new(target: Handle<T>) -> Self
pub fn new(target: Handle<T>) -> Self
Start building an instance targeting target — a Handle<T> for the
source asset (e.g. a Handle<Material> for a MaterialInstance).
Sourcepub fn with_texture(self, name: &'static str, handle: Handle<Texture>) -> Self
pub fn with_texture(self, name: &'static str, handle: Handle<Texture>) -> Self
Bind a processed GPUTexture, by its
source handle, under name.
Sourcepub fn with_texture_array(
self,
name: &'static str,
handle: Handle<TextureArray>,
) -> Self
pub fn with_texture_array( self, name: &'static str, handle: Handle<TextureArray>, ) -> Self
Bind a processed GPUTextureArray,
by its source handle, under name.
Sourcepub fn with_cubemap(self, name: &'static str, handle: Handle<Cubemap>) -> Self
pub fn with_cubemap(self, name: &'static str, handle: Handle<Cubemap>) -> Self
Bind a processed GPUCubemap, by its
source handle, under name.
Sourcepub fn with_sampler(self, name: &'static str, kind: SamplerKind) -> Self
pub fn with_sampler(self, name: &'static str, kind: SamplerKind) -> Self
Bind a sampler from the global sampler cache under name.
Sourcepub fn with_uniform(self, name: &'static str, data: Vec<u8>) -> Self
pub fn with_uniform(self, name: &'static str, data: Vec<u8>) -> Self
Bind raw bytes as a uniform buffer owned by this instance, under
name — updatable later via GPUBindingInstance::update.
Sourcepub fn with_storage(self, name: &'static str, data: Vec<u8>) -> Self
pub fn with_storage(self, name: &'static str, data: Vec<u8>) -> Self
Same as with_uniform but as a storage buffer.
Sourcepub fn with_param(self, name: &'static str, entry: BindingInstanceEntry) -> Self
pub fn with_param(self, name: &'static str, entry: BindingInstanceEntry) -> Self
Escape hatch for a dynamically-selected entry kind that doesn’t fit
the typed methods above (building entries in a loop over
heterogeneous data, say). Prefer with_texture/
with_sampler/etc. when the kind is known statically.
Sourcepub fn build(self) -> BindingInstance<T>
pub fn build(self) -> BindingInstance<T>
Consume the builder and return the finished BindingInstance value.
Sourcepub fn build_asset(
self,
name: &str,
assets: &mut Assets<BindingInstance<T>>,
) -> Handle<BindingInstance<T>>where
BindingInstance<T>: AssetSource,
pub fn build_asset(
self,
name: &str,
assets: &mut Assets<BindingInstance<T>>,
) -> Handle<BindingInstance<T>>where
BindingInstance<T>: AssetSource,
Consume the builder, insert into assets under name, and return
the resulting Handle<BindingInstance<T>>.
Auto Trait Implementations§
impl<T> Freeze for BindingInstanceBuilder<T>
impl<T> RefUnwindSafe for BindingInstanceBuilder<T>
impl<T> Send for BindingInstanceBuilder<T>
impl<T> Sync for BindingInstanceBuilder<T>
impl<T> Unpin for BindingInstanceBuilder<T>
impl<T> UnsafeUnpin for BindingInstanceBuilder<T>
impl<T> UnwindSafe for BindingInstanceBuilder<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more