pub enum OptionValue {
Bool(bool),
Int(i64),
Uint(u64),
Float(f64),
String(FixedStr),
Bytes(Bytes),
List(OptionList),
Message(OptionMessage),
Enum(FixedStr),
Duration(Duration),
Timestamp(Timestamp),
}Expand description
An enum representing values for protobuf options.
These can be composed manually by using one of the many provided From impls, or with the serde feature, which allows conversion from serde_json::Value.
Variants§
Bool(bool)
Int(i64)
Uint(u64)
Float(f64)
String(FixedStr)
Bytes(Bytes)
List(OptionList)
Message(OptionMessage)
Enum(FixedStr)
Duration(Duration)
Timestamp(Timestamp)
Implementations§
Source§impl OptionValue
impl OptionValue
Sourcepub fn new_message<I>(items: I) -> Selfwhere
I: Into<OptionMessage>,
pub fn new_message<I>(items: I) -> Selfwhere
I: Into<OptionMessage>,
Creates a new message option value.
Sourcepub fn new_list<I>(items: I) -> Selfwhere
I: Into<OptionList>,
pub fn new_list<I>(items: I) -> Selfwhere
I: Into<OptionList>,
Creates a new list option value.
Trait Implementations§
Source§impl Clone for OptionValue
impl Clone for OptionValue
Source§fn clone(&self) -> OptionValue
fn clone(&self) -> OptionValue
Returns a duplicate 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 OptionValue
impl Debug for OptionValue
Source§impl<'de> Deserialize<'de> for OptionValue
impl<'de> Deserialize<'de> for OptionValue
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
Source§impl Display for OptionValue
Implement the format!() trait for OptionValue
impl Display for OptionValue
Implement the format!() trait for OptionValue
Please be aware of the rendering performance notice in the Template trait.
Source§impl EnumVariantTemplate for OptionValue
impl EnumVariantTemplate for OptionValue
fn render_into_with_values<AskamaW>( &self, __askama_writer: &mut AskamaW, __askama_values: &dyn Values, ) -> Result<()>
Source§impl FastWritable for OptionValue
impl FastWritable for OptionValue
Source§fn write_into<AskamaW>(
&self,
dest: &mut AskamaW,
values: &dyn Values,
) -> Result<()>
fn write_into<AskamaW>( &self, dest: &mut AskamaW, values: &dyn Values, ) -> Result<()>
Used internally by askama to speed up writing some types.
Source§impl From<&'static [u8]> for OptionValue
impl From<&'static [u8]> for OptionValue
Source§impl From<&'static str> for OptionValue
impl From<&'static str> for OptionValue
Source§impl<const S: usize> From<[ProtoOption; S]> for OptionValue
impl<const S: usize> From<[ProtoOption; S]> for OptionValue
Source§fn from(value: [ProtoOption; S]) -> Self
fn from(value: [ProtoOption; S]) -> Self
Converts to this type from the input type.
Source§impl<N, V> From<BTreeMap<N, V>> for OptionValue
impl<N, V> From<BTreeMap<N, V>> for OptionValue
Source§impl From<Bytes> for OptionValue
impl From<Bytes> for OptionValue
Source§fn from(value: Bytes) -> OptionValue
fn from(value: Bytes) -> OptionValue
Converts to this type from the input type.
Source§impl From<CelRule> for OptionValue
impl From<CelRule> for OptionValue
Source§impl From<Duration> for OptionValue
impl From<Duration> for OptionValue
Source§impl From<Duration> for OptionValue
impl From<Duration> for OptionValue
Source§fn from(value: Duration) -> OptionValue
fn from(value: Duration) -> OptionValue
Converts to this type from the input type.
Source§impl From<FixedStr> for OptionValue
impl From<FixedStr> for OptionValue
Source§fn from(value: FixedStr) -> OptionValue
fn from(value: FixedStr) -> OptionValue
Converts to this type from the input type.
Source§impl<N, V> From<HashMap<N, V>> for OptionValue
impl<N, V> From<HashMap<N, V>> for OptionValue
Source§impl From<Ignore> for OptionValue
impl From<Ignore> for OptionValue
Source§impl From<OptionList> for OptionValue
impl From<OptionList> for OptionValue
Source§fn from(value: OptionList) -> OptionValue
fn from(value: OptionList) -> OptionValue
Converts to this type from the input type.
Source§impl From<OptionMessage> for OptionValue
impl From<OptionMessage> for OptionValue
Source§fn from(value: OptionMessage) -> OptionValue
fn from(value: OptionMessage) -> OptionValue
Converts to this type from the input type.
Source§impl<T: Into<Self> + Ord + Clone> From<SortedList<T>> for OptionValue
impl<T: Into<Self> + Ord + Clone> From<SortedList<T>> for OptionValue
Source§fn from(value: SortedList<T>) -> Self
fn from(value: SortedList<T>) -> Self
Converts to this type from the input type.
Source§impl From<Timestamp> for OptionValue
impl From<Timestamp> for OptionValue
Source§fn from(value: Timestamp) -> OptionValue
fn from(value: Timestamp) -> OptionValue
Converts to this type from the input type.
Source§impl From<Vec<ProtoOption>> for OptionValue
impl From<Vec<ProtoOption>> for OptionValue
Source§fn from(value: Vec<ProtoOption>) -> Self
fn from(value: Vec<ProtoOption>) -> Self
Converts to this type from the input type.
Source§impl From<bool> for OptionValue
impl From<bool> for OptionValue
Source§fn from(value: bool) -> OptionValue
fn from(value: bool) -> OptionValue
Converts to this type from the input type.
Source§impl From<f32> for OptionValue
impl From<f32> for OptionValue
Source§fn from(value: f32) -> OptionValue
fn from(value: f32) -> OptionValue
Converts to this type from the input type.
Source§impl From<f64> for OptionValue
impl From<f64> for OptionValue
Source§fn from(value: f64) -> OptionValue
fn from(value: f64) -> OptionValue
Converts to this type from the input type.
Source§impl From<i32> for OptionValue
impl From<i32> for OptionValue
Source§fn from(value: i32) -> OptionValue
fn from(value: i32) -> OptionValue
Converts to this type from the input type.
Source§impl From<i64> for OptionValue
impl From<i64> for OptionValue
Source§fn from(value: i64) -> OptionValue
fn from(value: i64) -> OptionValue
Converts to this type from the input type.
Source§impl From<u32> for OptionValue
impl From<u32> for OptionValue
Source§fn from(value: u32) -> OptionValue
fn from(value: u32) -> OptionValue
Converts to this type from the input type.
Source§impl From<u64> for OptionValue
impl From<u64> for OptionValue
Source§fn from(value: u64) -> OptionValue
fn from(value: u64) -> OptionValue
Converts to this type from the input type.
Source§impl From<usize> for OptionValue
impl From<usize> for OptionValue
Source§fn from(value: usize) -> OptionValue
fn from(value: usize) -> OptionValue
Converts to this type from the input type.
Source§impl PartialEq for OptionValue
impl PartialEq for OptionValue
Source§impl Serialize for OptionValue
impl Serialize for OptionValue
Source§impl Template for OptionValue
impl Template for OptionValue
Source§const SIZE_HINT: usize = 5usize
const SIZE_HINT: usize = 5usize
Provides a rough estimate of the expanded length of the rendered template. Larger
values result in higher memory usage but fewer reallocations. Smaller values result in the
opposite. This value only affects
render. It does not take effect when calling
render_into, write_into, the fmt::Display implementation, or the blanket
ToString::to_string implementation.Source§fn render_into_with_values<AskamaW>(
&self,
__askama_writer: &mut AskamaW,
__askama_values: &dyn Values,
) -> Result<()>
fn render_into_with_values<AskamaW>( &self, __askama_writer: &mut AskamaW, __askama_values: &dyn Values, ) -> Result<()>
Renders the template to the given
writer fmt buffer with provided Values.Source§fn render_with_values(&self, __askama_values: &dyn Values) -> Result<String>
fn render_with_values(&self, __askama_values: &dyn Values) -> Result<String>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it with provided Values.Source§fn render(&self) -> Result<String, Error>
fn render(&self) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it.Source§fn render_into<W>(&self, writer: &mut W) -> Result<(), Error>
fn render_into<W>(&self, writer: &mut W) -> Result<(), Error>
Renders the template to the given
writer fmt buffer.Source§impl TryFrom<Value> for OptionValue
Available on crate feature serde only.
impl TryFrom<Value> for OptionValue
Available on crate feature
serde only.impl StructuralPartialEq for OptionValue
Auto Trait Implementations§
impl !Freeze for OptionValue
impl RefUnwindSafe for OptionValue
impl Send for OptionValue
impl Sync for OptionValue
impl Unpin for OptionValue
impl UnsafeUnpin for OptionValue
impl UnwindSafe for OptionValue
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> DynTemplate for Twhere
T: Template,
impl<T> DynTemplate for Twhere
T: Template,
Source§fn dyn_render(&self) -> Result<String, Error>
fn dyn_render(&self) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it.Source§fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String, Error>
fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it with provided Values.Source§fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<(), Error>
fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<(), Error>
Renders the template to the given
writer fmt buffer.Source§fn dyn_render_into_with_values(
&self,
writer: &mut dyn Write,
values: &dyn Values,
) -> Result<(), Error>
fn dyn_render_into_with_values( &self, writer: &mut dyn Write, values: &dyn Values, ) -> Result<(), Error>
Renders the template to the given
writer fmt buffer with provided Values.Source§fn dyn_write_into(&self, writer: &mut dyn Write) -> Result<(), Error>
fn dyn_write_into(&self, writer: &mut dyn Write) -> Result<(), Error>
Available on crate feature
std only.Renders the template to the given
writer io buffer.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Change the foreground color to black
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Change the background color to black
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Change the foreground color to red
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Change the background color to red
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Change the foreground color to green
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Change the background color to green
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Change the foreground color to yellow
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Change the background color to yellow
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Change the foreground color to blue
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Change the background color to blue
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to magenta
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to purple
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to purple
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Change the foreground color to cyan
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Change the background color to cyan
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Change the foreground color to white
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Change the background color to white
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Make the text bold
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Make the text dim
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Make the text italicized
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Make the text underlined
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Make the text blink
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Swap the foreground and background colors
Hide the text
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.