pub enum JSONGetTextValue<'a> {
Str(&'a str),
JSONValue(Value),
JSONValueRef(&'a Value),
}Expand description
Represents any valid JSON value. Reference can also be wrapped.
Variants§
Implementations§
Source§impl<'a> JSONGetTextValue<'a>
impl<'a> JSONGetTextValue<'a>
Sourcepub fn from_str_ref<S: AsRef<str> + ?Sized>(s: &'a S) -> JSONGetTextValue<'a>
pub fn from_str_ref<S: AsRef<str> + ?Sized>(s: &'a S) -> JSONGetTextValue<'a>
Wrap a borrowed string slice without copying. Use from_string to store an owned string instead.
pub fn from_string<S: Into<String>>(s: S) -> JSONGetTextValue<'static>
pub fn from_json_str<S: AsRef<str>>( s: S, ) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
pub fn from_bool(b: bool) -> JSONGetTextValue<'static>
pub fn from_i8(n: i8) -> JSONGetTextValue<'static>
pub fn from_i16(n: i16) -> JSONGetTextValue<'static>
pub fn from_i32(n: i32) -> JSONGetTextValue<'static>
pub fn from_i64(n: i64) -> JSONGetTextValue<'static>
pub fn from_i128( n: i128, ) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
pub fn from_isize(n: isize) -> JSONGetTextValue<'static>
pub fn from_u8(n: u8) -> JSONGetTextValue<'static>
pub fn from_u16(n: u16) -> JSONGetTextValue<'static>
pub fn from_u32(n: u32) -> JSONGetTextValue<'static>
pub fn from_u64(n: u64) -> JSONGetTextValue<'static>
pub fn from_u128( n: u128, ) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
pub fn from_usize(n: usize) -> JSONGetTextValue<'static>
pub fn from_f32(n: f32) -> JSONGetTextValue<'static>
pub fn from_f64(n: f64) -> JSONGetTextValue<'static>
pub fn from_json_value(v: Value) -> JSONGetTextValue<'static>
pub fn from_json_value_ref(v: &'a Value) -> JSONGetTextValue<'a>
pub fn from_serializable<T: Serialize>( v: T, ) -> Result<JSONGetTextValue<'static>, Error>
pub fn null() -> JSONGetTextValue<'static>
Source§impl<'a> JSONGetTextValue<'a>
impl<'a> JSONGetTextValue<'a>
Sourcepub fn to_json_string(&self) -> String
pub fn to_json_string(&self) -> String
Convert to a string for JSON format.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Convert to a string slice if it is possible (if it is a string).
Sourcepub fn as_json_value(&self) -> Option<&Value>
pub fn as_json_value(&self) -> Option<&Value>
Get the wrapped serde_json::Value if this is not a borrowed string slice.
Sourcepub fn clone_borrowed(&self) -> JSONGetTextValue<'_>
pub fn clone_borrowed(&self) -> JSONGetTextValue<'_>
Clone the reference of this JSONGetTextValue instance.
Source§impl<'a> JSONGetTextValue<'a>
impl<'a> JSONGetTextValue<'a>
pub fn parse_json<S: AsRef<str>>( s: S, ) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
Trait Implementations§
Source§impl<'a> Clone for JSONGetTextValue<'a>
impl<'a> Clone for JSONGetTextValue<'a>
Source§fn clone(&self) -> JSONGetTextValue<'a>
fn clone(&self) -> JSONGetTextValue<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for JSONGetTextValue<'a>
impl<'a> Debug for JSONGetTextValue<'a>
Source§impl<'de> Deserialize<'de> for JSONGetTextValue<'de>
impl<'de> Deserialize<'de> for JSONGetTextValue<'de>
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>,
Source§impl<'a> Display for JSONGetTextValue<'a>
impl<'a> Display for JSONGetTextValue<'a>
impl<'a> Eq for JSONGetTextValue<'a>
Source§impl<'a> From<&'a Value> for JSONGetTextValue<'a>
impl<'a> From<&'a Value> for JSONGetTextValue<'a>
Source§fn from(v: &'a Value) -> JSONGetTextValue<'a>
fn from(v: &'a Value) -> JSONGetTextValue<'a>
Source§impl<'a> From<&'a str> for JSONGetTextValue<'a>
impl<'a> From<&'a str> for JSONGetTextValue<'a>
Source§fn from(v: &'a str) -> JSONGetTextValue<'a>
fn from(v: &'a str) -> JSONGetTextValue<'a>
Source§impl From<String> for JSONGetTextValue<'static>
impl From<String> for JSONGetTextValue<'static>
Source§fn from(v: String) -> JSONGetTextValue<'static>
fn from(v: String) -> JSONGetTextValue<'static>
Source§impl From<Value> for JSONGetTextValue<'static>
impl From<Value> for JSONGetTextValue<'static>
Source§fn from(v: Value) -> JSONGetTextValue<'static>
fn from(v: Value) -> JSONGetTextValue<'static>
Source§impl From<bool> for JSONGetTextValue<'static>
impl From<bool> for JSONGetTextValue<'static>
Source§fn from(v: bool) -> JSONGetTextValue<'static>
fn from(v: bool) -> JSONGetTextValue<'static>
Source§impl From<f32> for JSONGetTextValue<'static>
impl From<f32> for JSONGetTextValue<'static>
Source§fn from(v: f32) -> JSONGetTextValue<'static>
fn from(v: f32) -> JSONGetTextValue<'static>
Source§impl From<f64> for JSONGetTextValue<'static>
impl From<f64> for JSONGetTextValue<'static>
Source§fn from(v: f64) -> JSONGetTextValue<'static>
fn from(v: f64) -> JSONGetTextValue<'static>
Source§impl From<i8> for JSONGetTextValue<'static>
impl From<i8> for JSONGetTextValue<'static>
Source§fn from(v: i8) -> JSONGetTextValue<'static>
fn from(v: i8) -> JSONGetTextValue<'static>
Source§impl From<i16> for JSONGetTextValue<'static>
impl From<i16> for JSONGetTextValue<'static>
Source§fn from(v: i16) -> JSONGetTextValue<'static>
fn from(v: i16) -> JSONGetTextValue<'static>
Source§impl From<i32> for JSONGetTextValue<'static>
impl From<i32> for JSONGetTextValue<'static>
Source§fn from(v: i32) -> JSONGetTextValue<'static>
fn from(v: i32) -> JSONGetTextValue<'static>
Source§impl From<i64> for JSONGetTextValue<'static>
impl From<i64> for JSONGetTextValue<'static>
Source§fn from(v: i64) -> JSONGetTextValue<'static>
fn from(v: i64) -> JSONGetTextValue<'static>
Source§impl From<isize> for JSONGetTextValue<'static>
impl From<isize> for JSONGetTextValue<'static>
Source§fn from(v: isize) -> JSONGetTextValue<'static>
fn from(v: isize) -> JSONGetTextValue<'static>
Source§impl From<u8> for JSONGetTextValue<'static>
impl From<u8> for JSONGetTextValue<'static>
Source§fn from(v: u8) -> JSONGetTextValue<'static>
fn from(v: u8) -> JSONGetTextValue<'static>
Source§impl From<u16> for JSONGetTextValue<'static>
impl From<u16> for JSONGetTextValue<'static>
Source§fn from(v: u16) -> JSONGetTextValue<'static>
fn from(v: u16) -> JSONGetTextValue<'static>
Source§impl From<u32> for JSONGetTextValue<'static>
impl From<u32> for JSONGetTextValue<'static>
Source§fn from(v: u32) -> JSONGetTextValue<'static>
fn from(v: u32) -> JSONGetTextValue<'static>
Source§impl From<u64> for JSONGetTextValue<'static>
impl From<u64> for JSONGetTextValue<'static>
Source§fn from(v: u64) -> JSONGetTextValue<'static>
fn from(v: u64) -> JSONGetTextValue<'static>
Source§impl From<usize> for JSONGetTextValue<'static>
impl From<usize> for JSONGetTextValue<'static>
Source§fn from(v: usize) -> JSONGetTextValue<'static>
fn from(v: usize) -> JSONGetTextValue<'static>
Source§impl<'v> FromFormField<'v> for JSONGetTextValue<'v>
impl<'v> FromFormField<'v> for JSONGetTextValue<'v>
Source§fn from_value(field: ValueField<'v>) -> Result<'v, Self>
fn from_value(field: ValueField<'v>) -> Result<'v, Self>
T from a form value field. Read moreSource§impl<'a> FromParam<'a> for JSONGetTextValue<'a>
Available on crate feature rocket only.
impl<'a> FromParam<'a> for JSONGetTextValue<'a>
rocket only.Source§type Error = JSONGetTextValueError
type Error = JSONGetTextValueError
Source§impl FromStr for JSONGetTextValue<'static>
impl FromStr for JSONGetTextValue<'static>
Source§impl<'a> PartialEq for JSONGetTextValue<'a>
impl<'a> PartialEq for JSONGetTextValue<'a>
Source§impl<'a> PartialEq<JSONGetTextValue<'a>> for str
impl<'a> PartialEq<JSONGetTextValue<'a>> for str
Source§impl<'a> PartialEq<JSONGetTextValue<'a>> for &'a str
impl<'a> PartialEq<JSONGetTextValue<'a>> for &'a str
Source§impl<'a> PartialEq<str> for JSONGetTextValue<'a>
impl<'a> PartialEq<str> for JSONGetTextValue<'a>
Source§impl<'r, 'o: 'r> Responder<'r, 'o> for JSONGetTextValue<'o>
Available on crate feature rocket only.
impl<'r, 'o: 'r> Responder<'r, 'o> for JSONGetTextValue<'o>
rocket only.Source§impl<'a> Serialize for JSONGetTextValue<'a>
impl<'a> Serialize for JSONGetTextValue<'a>
impl<'a> StructuralPartialEq for JSONGetTextValue<'a>
Source§impl TryFrom<i128> for JSONGetTextValue<'static>
impl TryFrom<i128> for JSONGetTextValue<'static>
Source§type Error = JSONGetTextValueError
type Error = JSONGetTextValueError
Source§fn try_from(v: i128) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
fn try_from(v: i128) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
Source§impl TryFrom<u128> for JSONGetTextValue<'static>
impl TryFrom<u128> for JSONGetTextValue<'static>
Source§type Error = JSONGetTextValueError
type Error = JSONGetTextValueError
Source§fn try_from(v: u128) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
fn try_from(v: u128) -> Result<JSONGetTextValue<'static>, JSONGetTextValueError>
Auto Trait Implementations§
impl<'a> Freeze for JSONGetTextValue<'a>
impl<'a> RefUnwindSafe for JSONGetTextValue<'a>
impl<'a> Send for JSONGetTextValue<'a>
impl<'a> Sync for JSONGetTextValue<'a>
impl<'a> Unpin for JSONGetTextValue<'a>
impl<'a> UnsafeUnpin for JSONGetTextValue<'a>
impl<'a> UnwindSafe for JSONGetTextValue<'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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<'v, T> FromForm<'v> for Twhere
T: FromFormField<'v>,
impl<'v, T> FromForm<'v> for Twhere
T: FromFormField<'v>,
Source§fn init(opts: Options) -> <T as FromForm<'v>>::Context
fn init(opts: Options) -> <T as FromForm<'v>>::Context
Self.Source§fn push_value(ctxt: &mut <T as FromForm<'v>>::Context, field: ValueField<'v>)
fn push_value(ctxt: &mut <T as FromForm<'v>>::Context, field: ValueField<'v>)
field.Source§fn push_data<'life0, 'life1, 'async_trait>(
ctxt: &'life0 mut FromFieldContext<'v, T>,
field: DataField<'v, 'life1>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'v: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn push_data<'life0, 'life1, 'async_trait>(
ctxt: &'life0 mut FromFieldContext<'v, T>,
field: DataField<'v, 'life1>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'v: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
field.Source§fn finalize(ctxt: <T as FromForm<'v>>::Context) -> Result<T, Errors<'v>>
fn finalize(ctxt: <T as FromForm<'v>>::Context) -> Result<T, Errors<'v>>
Errors otherwise.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> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);