pub struct FormatStringOptions<'a> { /* private fields */ }Expand description
Builder-style options for FormatString::resolve_with and
FormatString::resolve_string_with.
All fields are optional; defaults match the zero-argument shortcuts on
FormatString (host-native path format, no library, no path mapping rules,
no target type coercion). Chain the with_* methods to override any subset.
let fs = FormatString::new("{{Param.Frame}}").unwrap();
let st = SymbolTable::new();
let target = ExprType::INT;
let opts = FormatStringOptions::new()
.with_path_format(PathFormat::Posix)
.with_target_type(&target);
let _ = fs.resolve_with(&st, &opts);Implementations§
Source§impl<'a> FormatStringOptions<'a>
impl<'a> FormatStringOptions<'a>
Sourcepub fn with_library(
self,
library: impl Into<Option<&'a FunctionLibrary>>,
) -> Self
pub fn with_library( self, library: impl Into<Option<&'a FunctionLibrary>>, ) -> Self
Use the given function library instead of the default (built-in) one.
Accepts either &FunctionLibrary or Option<&FunctionLibrary>; None
means “use the default library”. To enable apply_path_mapping, pass
a library obtained from FunctionLibrary::for_profile with
HostContext::WithRules on the profile.
Sourcepub fn with_path_format(self, fmt: PathFormat) -> Self
pub fn with_path_format(self, fmt: PathFormat) -> Self
Construct path() values in this format (default: host-native).
Sourcepub fn with_target_type(self, t: &'a ExprType) -> Self
pub fn with_target_type(self, t: &'a ExprType) -> Self
Coerce the resolved value toward this target type.
Ignored by resolve_string_with.
Trait Implementations§
Source§impl<'a> Clone for FormatStringOptions<'a>
impl<'a> Clone for FormatStringOptions<'a>
Source§fn clone(&self) -> FormatStringOptions<'a>
fn clone(&self) -> FormatStringOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for FormatStringOptions<'a>
impl<'a> !RefUnwindSafe for FormatStringOptions<'a>
impl<'a> Send for FormatStringOptions<'a>
impl<'a> Sync for FormatStringOptions<'a>
impl<'a> Unpin for FormatStringOptions<'a>
impl<'a> UnsafeUnpin for FormatStringOptions<'a>
impl<'a> !UnwindSafe for FormatStringOptions<'a>
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
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>
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>
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