Struct llm_chain::options::OptionsBuilder
source · pub struct OptionsBuilder { /* private fields */ }Expand description
OptionsBuilder is a helper structure used to construct Options in a flexible way.
OptionsBuilder follows the builder pattern, providing a fluent interface to add options
and finally, build an Options instance. This pattern is used to handle cases where the Options
instance may require complex configuration or optional fields.
Example
let mut builder = OptionsBuilder::new();
builder.add_option(Opt::Model(ModelRef::from_path("path_to_model")));
let options = builder.build();Implementations§
source§impl OptionsBuilder
impl OptionsBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new, empty OptionsBuilder.
Returns an OptionsBuilder instance with an empty opts field.
Example
let builder = OptionsBuilder::new();sourcepub fn add_option(&mut self, opt: Opt)
pub fn add_option(&mut self, opt: Opt)
sourcepub fn build(self) -> Options
pub fn build(self) -> Options
Consumes the OptionsBuilder, returning an Options instance.
This function consumes the OptionsBuilder, moving its opts field to a new Options instance.
Returns
An Options instance with the options added through the builder.
Example
let mut builder = OptionsBuilder::new();
builder.add_option(Opt::Model(ModelRef::from_path("path_to_model")));
let options = builder.build();Trait Implementations§
source§impl Clone for OptionsBuilder
impl Clone for OptionsBuilder
source§fn clone(&self) -> OptionsBuilder
fn clone(&self) -> OptionsBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for OptionsBuilder
impl Debug for OptionsBuilder
source§impl Default for OptionsBuilder
impl Default for OptionsBuilder
source§fn default() -> OptionsBuilder
fn default() -> OptionsBuilder
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for OptionsBuilder
impl<'de> Deserialize<'de> for OptionsBuilder
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for OptionsBuilder
impl Send for OptionsBuilder
impl Sync for OptionsBuilder
impl Unpin for OptionsBuilder
impl UnwindSafe for OptionsBuilder
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