Struct Branch
pub struct Branch<S> {
pub sample_mask: Option<S>,
pub temperature: Option<f32>,
pub splices: Vec<Splice>,
}
Fields§
§sample_mask: Option<S>
If None, no sampling is performed. If Some(set), only tokens from the set are allowed.
temperature: Option<f32>
Override temperature for sampling. It may or may not be sticky.
splices: Vec<Splice>
Describes what to do after sampling.
If no sampling, there should be exactly one splice, with empty when_sampled
.
Implementations§
§impl<S> Branch<S>
impl<S> Branch<S>
pub fn map_mask<F, T>(&self, f: F) -> Branch<T>
pub fn find_splice(&self, sampled: u32) -> Option<&Splice>
pub fn spliced(&self, sampled: u32) -> Splice
pub fn unconditional_splice(&self) -> Option<&Splice>
pub fn has_backtrack(&self) -> bool
pub fn has_ff_tokens(&self) -> bool
pub fn stop() -> Branch<S>
pub fn is_stop(&self) -> bool
pub fn splice(backtrack: u32, ff_tokens: Vec<u32>) -> Branch<S>
pub fn noop() -> Branch<S>
pub fn sample(set: S, temperature: Option<f32>) -> Branch<S>
Trait Implementations§
§impl<'de, S> Deserialize<'de> for Branch<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Branch<S>where
S: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Branch<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Branch<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<S> Serialize for Branch<S>where
S: Serialize,
impl<S> Serialize for Branch<S>where
S: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<S> Freeze for Branch<S>where
S: Freeze,
impl<S> RefUnwindSafe for Branch<S>where
S: RefUnwindSafe,
impl<S> Send for Branch<S>where
S: Send,
impl<S> Sync for Branch<S>where
S: Sync,
impl<S> Unpin for Branch<S>where
S: Unpin,
impl<S> UnwindSafe for Branch<S>where
S: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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