Skip to main content

StyleProfile

Struct StyleProfile 

Source
#[non_exhaustive]
pub struct StyleProfile { pub name: String, pub verbosity: Verbosity, pub sentence_length: LengthDistribution, pub connectives: ConnectivePreferences, pub list_style_bias: ListStyleBias, pub pronoun_density: PronounDensity, pub hedging: HedgingCalibration, pub salience: SalienceBias, }
Expand description

A declarative voice configuration for the engine.

Profiles are immutable per engine. Build one through StyleProfile::builder, a serde-deserialized prosaic.toml [style_profile] section, or one of the catalog presets. Apply via Engine::style_profile.

StyleProfile::neutral() is the byte-for-byte-equivalent baseline: constructing an engine with .style_profile(StyleProfile::neutral()) produces output identical to constructing it with no profile at all. This invariant is the backwards-compatibility gate for the entire design and is asserted by the round-trip tests at the workspace level.

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.
§name: String§verbosity: Verbosity§sentence_length: LengthDistribution§connectives: ConnectivePreferences§list_style_bias: ListStyleBias§pronoun_density: PronounDensity§hedging: HedgingCalibration§salience: SalienceBias

Implementations§

Source§

impl StyleProfile

Source

pub fn neutral() -> Self

The byte-for-byte-equivalent baseline. Every dial in its neutral position; constructing an engine with this profile produces the same output as constructing it with no profile at all.

Source

pub fn builder(name: impl Into<String>) -> StyleProfileBuilder

Start a builder rooted at neutral() with the given name.

Source

pub fn is_neutral(&self) -> bool

true when this profile is byte-for-byte equivalent to the neutral baseline — i.e., when every decision site can short-circuit its profile-aware path. The name field is ignored: a custom name applied to neutral dials is still an effective no-op.

Source

pub fn validate(&self) -> Result<(), StyleProfileError>

Validate the profile against the documented invariants. Called by the builder’s build() and at the engine boundary; consumers passing a deserialized profile should call this before applying it to an engine.

Trait Implementations§

Source§

impl Clone for StyleProfile

Source§

fn clone(&self) -> StyleProfile

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 StyleProfile

Source§

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

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

impl Default for StyleProfile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for StyleProfile

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StyleProfile

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> 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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.