Skip to main content

WriteOptions

Struct WriteOptions 

Source
#[non_exhaustive]
pub struct WriteOptions { pub label: String, pub overwrite_unowned: bool, pub allow_partial: bool, pub source_id: Option<String>, pub replace_source: bool, }
Expand description

How a write() treats the output directory.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§label: String

Names this generation target, together with the language. Two targets writing to one directory need different labels, and their generated files need different names.

§overwrite_unowned: bool

Overwrite an existing file that no manifest owns. Off by default: such a file is probably hand-written. One that already holds exactly the generated content is adopted either way, since nothing is lost.

§allow_partial: bool

Write a generation that carries Error diagnostics. Off by default: such a generation is missing the types the errors suppressed. When it writes such a generation, files the previous run wrote are kept rather than removed as stale; a clean generation removes them as usual.

§source_id: Option<String>

What this label was generated from, recorded in the manifest. When set, a later run under the same label from a different source is refused, so two descriptions cannot overwrite each other’s output. The roas command line uses the description’s path relative to the output directory, without a .json/.yaml/.yml extension, so moving between JSON and YAML keeps the label. An empty id counts as none, and switches the check off: use a non-empty one, such as ., for a source that has no shorter name.

§replace_source: bool

Accept a different source_id than the one the label recorded, and record the new one: the description moved or was renamed. Off by default, so a second description cannot take over a label by accident.

Implementations§

Source§

impl WriteOptions

Source

pub fn new(label: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Clone for WriteOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriteOptions

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for WriteOptions

Source§

impl PartialEq for WriteOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WriteOptions

Auto Trait Implementations§

§

impl Forget for WriteOptions

§

impl Freeze for WriteOptions
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for WriteOptions

§

impl RefUnwindSafe for WriteOptions

§

impl Send for WriteOptions
where RawVecInner: Send,

§

impl Sync for WriteOptions
where RawVecInner: Sync,

§

impl Unpin for WriteOptions
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for WriteOptions

§

impl UnwindSafe for WriteOptions
where RawVecInner: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
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<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.