Struct includer_codegen::Codegen[][src]

pub struct Codegen { /* fields omitted */ }

A code generation builder.

By default the path written to is $OUT_DIR/assets.rs where $OUT_DIR is from your environmental variables. This is usually set by cargo. If $OUT_DIR is not set, then no path is set.

An unlimited amount of Pipelines can be added and they will be written to the file in the same order as they were added.

Methods

impl Codegen
[src]

Creates a Codegen instance.

If the cargo env var OUT_DIR is set, the path is automatically set to $OUT_DIR/assets.rs, otherwise a path is not set. In that case you are able to explicitly able to specify the path with set_path.

use includer_codegen::prelude::*;

let c = Codegen::new();

Returns the currently set path.

use std::path::Path;
use includer_codegen::prelude::*;

let c = Codegen::new().set_path("./out/gen.rs");
assert_eq!(c.path(), Some(Path::new("./out/gen.rs")));

Sets the output path for the generated file.

use includer_codegen::prelude::*;

Codegen::new().set_path("./out/gen.rs");

Returns a list of all currently set Pipelines

Add a Pipeline to the Codegen instance.

use includer_codegen::prelude::*;

Codegen::new().pipe(Assets::new("ASSETS", "../web/dist").build());

Writes everything to file and returns the written amount.

use includer_codegen::prelude::*;

Codegen::new()
    .pipe(Assets::new("ASSETS", "../web/dist").build())
    .write();

Panics

If path is not set then this function will panic.

A panic will also happen when any file operation fails - such as opening, writing, or closing.

Trait Implementations

impl Default for Codegen
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl !Send for Codegen

impl !Sync for Codegen