#[non_exhaustive]pub enum Toggle<T> {
Off,
On(T),
}Expand description
Turns a boolean | config option on or off: true.into(), false.into() or a config
.into().
use strands::Toggle;
use strands::memory::MemoryToolConfig;
let on: Toggle<MemoryToolConfig> = true.into();
assert_eq!(on, Toggle::On(MemoryToolConfig::default()));
let off: Toggle<MemoryToolConfig> = false.into();
assert_eq!(off, Toggle::Off);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
Source§impl From<ArchiveConfig> for Toggle<ArchiveConfig>
impl From<ArchiveConfig> for Toggle<ArchiveConfig>
Source§fn from(config: ArchiveConfig) -> Self
fn from(config: ArchiveConfig) -> Self
Converts to this type from the input type.
Source§impl From<BackgroundTasksConfig> for Toggle<BackgroundTasksConfig>
impl From<BackgroundTasksConfig> for Toggle<BackgroundTasksConfig>
Source§fn from(config: BackgroundTasksConfig) -> Self
fn from(config: BackgroundTasksConfig) -> Self
Converts to this type from the input type.
Source§impl From<ExtractionConfig> for Toggle<ExtractionConfig>
impl From<ExtractionConfig> for Toggle<ExtractionConfig>
Source§fn from(config: ExtractionConfig) -> Self
fn from(config: ExtractionConfig) -> Self
Converts to this type from the input type.
Source§impl From<FileMemoryExtractionConfig> for Toggle<FileMemoryExtractionConfig>
impl From<FileMemoryExtractionConfig> for Toggle<FileMemoryExtractionConfig>
Source§fn from(config: FileMemoryExtractionConfig) -> Self
fn from(config: FileMemoryExtractionConfig) -> Self
Converts to this type from the input type.
Source§impl From<MemoryAddToolConfig> for Toggle<MemoryAddToolConfig>
impl From<MemoryAddToolConfig> for Toggle<MemoryAddToolConfig>
Source§fn from(config: MemoryAddToolConfig) -> Self
fn from(config: MemoryAddToolConfig) -> Self
Converts to this type from the input type.
Source§impl From<MemoryInjectionConfig> for Toggle<MemoryInjectionConfig>
impl From<MemoryInjectionConfig> for Toggle<MemoryInjectionConfig>
Source§fn from(config: MemoryInjectionConfig) -> Self
fn from(config: MemoryInjectionConfig) -> Self
Converts to this type from the input type.
Source§impl From<MemoryToolConfig> for Toggle<MemoryToolConfig>
impl From<MemoryToolConfig> for Toggle<MemoryToolConfig>
Source§fn from(config: MemoryToolConfig) -> Self
fn from(config: MemoryToolConfig) -> Self
Converts to this type from the input type.
impl<T: PartialEq> StructuralPartialEq for Toggle<T>
Auto Trait Implementations§
impl<T> Freeze for Toggle<T>where
T: Freeze,
impl<T> RefUnwindSafe for Toggle<T>where
T: RefUnwindSafe,
impl<T> Send for Toggle<T>where
T: Send,
impl<T> Sync for Toggle<T>where
T: Sync,
impl<T> Unpin for Toggle<T>where
T: Unpin,
impl<T> UnsafeUnpin for Toggle<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Toggle<T>where
T: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreCreates a shared type from an unshared type.