[][src]Struct buildtime_png::Builder

pub struct Builder { /* fields omitted */ }

Methods

impl Builder[src]

pub fn new() -> Self[src]

Simply calls Builder::default().

pub fn with_out_dir<P: AsRef<Path>>(&mut self, outdir: P) -> &mut Self[src]

Customize where the pixel .data files are placed in.

Because absolute paths is used in the generated rust code, you do not have to worry about where these files are, usually.

Default is OUT_DIR

pub fn include_png<P: AsRef<Path>>(
    &mut self,
    path_rel_to_root: P,
    ident: &str
) -> &mut Self
[src]

Add a image.

This method will read the image pointed to by path_rel_to_root, decode it, and emits relevant .data files into the out_dir perviously set (default to OUT_DIR).

Arguments

  • path_rel_to_root - Path of the image, relative to the directory where your Cargo.toml is placed.

ident - An identifier for the image to use in your code. Must be valid rust identifiers, such as image, left_arrow and not 123, a/b, a b, a-b or a::b.

pub fn emit_source_file(&self) -> Result<()>[src]

Emit the rust source file to $OUTDIR/image.rs

pub fn emit_source_file_at<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Emit the rust source file to the provided path, relative to the output directory.

Source file contains absolute paths, so you don't have to worry about the placement of it.

Trait Implementations

impl Default for Builder[src]

Auto Trait Implementations

impl Send for Builder

impl Unpin for Builder

impl Sync for Builder

impl UnwindSafe for Builder

impl RefUnwindSafe for Builder

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]