pub struct ExtStr {
pub name: String,
pub value: String,
}Fields§
§name: String§value: StringTrait Implementations§
Source§impl FromStr for ExtStr
Parses a string like name=<value>, or name and reads value from env variable.
With no value it will be read from env variable.
If env variable is not found then it will be an error.
Value can contain = symbol.
impl FromStr for ExtStr
Parses a string like name=<value>, or name and reads value from env variable.
With no value it will be read from env variable.
If env variable is not found then it will be an error.
Value can contain = symbol.
use std::str::FromStr;
use jrsonnet_cli::ExtStr;
let ext = ExtStr::from_str("name=value").unwrap();
assert_eq!(ext.name, "name");
assert_eq!(ext.value, "value");
std::env::set_var("name", "value");
let ext = ExtStr::from_str("name").unwrap();
assert_eq!(ext.name, "name");
assert_eq!(ext.value, "value");
let ext = ExtStr::from_str("name=value=with=equals").unwrap();
assert_eq!(ext.name, "name");
assert_eq!(ext.value, "value=with=equals");Auto Trait Implementations§
impl Freeze for ExtStr
impl RefUnwindSafe for ExtStr
impl Send for ExtStr
impl Sync for ExtStr
impl Unpin for ExtStr
impl UnsafeUnpin for ExtStr
impl UnwindSafe for ExtStr
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§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