Skip to main content

Output

Struct Output 

Source
pub struct Output {
    pub rust: String,
    pub views: bool,
    pub warnings: Vec<String>,
    /* private fields */
}
Expand description

What generating one library produced: a schema library, or the family of a plugin that declares no schema.

The declarations are the contract: a registry built from them answers what a registry built from upstream’s own schema data answers. They reach a consumer as the SCHEMAS table in rust, and this crate’s own callers through with_family.

Fields§

§rust: String

The generated file: this library’s tokens and schema data, and its views unless they were left out.

§views: bool

Whether rust carries the views: Views::Skip was asked for, or the schema declared skipCodeGeneration.

§warnings: Vec<String>

What a schema author should know, though the output is still correct.

Implementations§

Source§

impl Output

Source

pub fn library_name(&self) -> &str

The library’s name: the libraryName its schema declared, or the name of the plugin a declaration family was generated from.

Source

pub fn layers(&self) -> &[PathBuf]

Where every layer the schema resolved to was found, which is what a build script watches. A layer reached through a search_path is here by the location it was found at, not the bare relative path the schema asked for.

Source

pub fn with_family<R>(&self, f: impl FnOnce(&SchemaFamily<'_>) -> R) -> R

Calls f with this library’s schemas as a declared family — the schema data itself, and the same declarations the generated table carries.

A usd::SchemaFamily is a view over its parts, so it arrives through a closure rather than as a value: what it borrows lives for the call. usd::SchemaRegistryBuilder::register takes it, and usd::SchemaFamily::to_data turns it into the class prims a generatedSchema.usda would carry.

let output = openusd_build::configure()
    .build_library("schemas/usdGeom/schema.usda", openusd_build::Views::Generate)?;
let data = output.with_family(|family| family.to_data());

Trait Implementations§

Source§

impl Debug for Output

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.