Struct SpecificChannelsBuilder
pub struct SpecificChannelsBuilder<RecursiveChannels, RecursivePixel> { /* private fields */ }
Used to construct a SpecificChannels.
Call with_named_channel as many times as desired,
and then call with_pixels to define the colors.
Implementations
impl<RecursiveChannels: CheckDuplicates, RecursivePixel> SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
fn with_channel<Sample: IntoSample>(self, name: impl Into<Text>) -> SpecificChannelsBuilder<Recursive<RecursiveChannels, ChannelDescription>, Recursive<RecursivePixel, Sample>>Add another channel to this image. Does not add the actual pixels, but instead only declares the presence of the channel. Panics if the name contains unsupported characters. Panics if a channel with the same name already exists. Use
Text::new_or_none()to manually handle these cases. Usewith_channel_detailsinstead if you want to specify more options than just the name of the channel. The generic parameter can usually be inferred from the closure inwith_pixels.fn with_channel_details<Sample: Into<Sample>>(self, channel: ChannelDescription) -> SpecificChannelsBuilder<Recursive<RecursiveChannels, ChannelDescription>, Recursive<RecursivePixel, Sample>>Add another channel to this image. Does not add the actual pixels, but instead only declares the presence of the channel. Use
with_channelinstead if you only want to specify the name of the channel. Panics if a channel with the same name already exists. The generic parameter can usually be inferred from the closure inwith_pixels.fn with_pixels<Pixels>(self, get_pixel: Pixels) -> SpecificChannels<Pixels, RecursiveChannels> where Pixels: GetPixel, <Pixels as GetPixel>::Pixel: IntoRecursive<Recursive = RecursivePixel>,Specify the actual pixel contents of the image. You can pass a closure that returns a color for each pixel (
Fn(Vec2<usize>) -> Pixel), or you can pass your own image if it implementsGetPixel. The pixel type must be a tuple with the correct number of entries, depending on the number of channels. The tuple entries can be eitherf16,f32,u32orSample. Usewith_pixel_fninstead of this function, to get extra type safety for your pixel closure.fn with_pixel_fn<Pixel, Pixels>(self, get_pixel: Pixels) -> SpecificChannels<Pixels, RecursiveChannels> where Pixels: Sync + Fn(Vec2<usize>) -> Pixel, Pixel: IntoRecursive<Recursive = RecursivePixel>,Specify the contents of the image. The pixel type must be a tuple with the correct number of entries, depending on the number of channels. The tuple entries can be either
f16,f32,u32orSample. Usewith_pixelsinstead of this function, if you want to pass an object that is not a closure.Usually, the compiler can infer the type of the pixel (for example,
f16,f32,f32) from the closure. If that's not possible, you can specify the type of the channels when declaring the channel (for example,with_named_channel::<f32>("R")).
Trait Implementations
impl<RecursiveChannels: Debug, RecursivePixel: Debug> Debug for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<RecursiveChannels, RecursivePixel> Freeze for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: Freeze,
PhantomData<RecursivePixel>: Freeze,
impl<RecursiveChannels, RecursivePixel> RefUnwindSafe for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: RefUnwindSafe,
PhantomData<RecursivePixel>: RefUnwindSafe,
impl<RecursiveChannels, RecursivePixel> Send for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: Send,
PhantomData<RecursivePixel>: Send,
impl<RecursiveChannels, RecursivePixel> Sync for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: Sync,
PhantomData<RecursivePixel>: Sync,
impl<RecursiveChannels, RecursivePixel> Unpin for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: Unpin,
PhantomData<RecursivePixel>: Unpin,
impl<RecursiveChannels, RecursivePixel> UnsafeUnpin for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: UnsafeUnpin,
PhantomData<RecursivePixel>: UnsafeUnpin,
impl<RecursiveChannels, RecursivePixel> UnwindSafe for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
RecursiveChannels: UnwindSafe,
PhantomData<RecursivePixel>: UnwindSafe,
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
T: ?Sized,
impl<T, U> Into<U> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>