pub struct Profile {
pub constants: Vec<UserConstant>,
pub functions: Vec<UserFunction>,
pub symbol_names: HashMap<Symbol, String>,
pub symbol_weights: HashMap<Symbol, u32>,
pub includes: Vec<PathBuf>,
}Expand description
Parsed profile configuration
Fields§
§constants: Vec<UserConstant>User-defined constants
functions: Vec<UserFunction>User-defined functions
symbol_names: HashMap<Symbol, String>Custom symbol names (e.g., :p:π)
symbol_weights: HashMap<Symbol, u32>Custom symbol weights
includes: Vec<PathBuf>Additional profile files to include
Implementations§
Source§impl Profile
impl Profile
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ProfileError>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ProfileError>
Load a profile from a file
Sourcepub fn load_default() -> Self
pub fn load_default() -> Self
Load the default profile chain (~/.ries_profile, ./.ries)
Sourcepub fn add_constant(
&mut self,
weight: u32,
name: String,
description: String,
value: f64,
) -> Result<(), ProfileError>
pub fn add_constant( &mut self, weight: u32, name: String, description: String, value: f64, ) -> Result<(), ProfileError>
Add a validated user constant to this profile.
This method centralizes validation logic to ensure consistent handling of user constants across CLI and profile file parsing.
§Arguments
weight- Complexity weight for this constantname- Short name (single character preferred)description- Human-readable descriptionvalue- Numeric value
§Errors
Returns an error if:
nameis emptyvalueis not finite (NaN or infinity)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
impl UnwindSafe for Profile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more