pub struct SourceSet { /* private fields */ }Expand description
The sources one argument accepts.
Implementations§
Source§impl SourceSet
impl SourceSet
Sourcepub fn new<I: IntoIterator<Item = SourceScheme>>(schemes: I) -> Self
pub fn new<I: IntoIterator<Item = SourceScheme>>(schemes: I) -> Self
Exactly the listed schemes, in the order they will be documented.
Sourcepub fn config() -> Self
pub fn config() -> Self
The two sources a value can come from without a terminal or a pipe: an environment variable, or an address in a document. This is the set most arguments want.
Sourcepub fn stream() -> Self
pub fn stream() -> Self
SourceSet::config plus the streams — for a value that may be piped
in, handed over on an inherited descriptor, or typed by a person.
Sourcepub fn host_scheme(
self,
name: impl Into<String>,
syntax: impl Into<String>,
) -> Self
pub fn host_scheme( self, name: impl Into<String>, syntax: impl Into<String>, ) -> Self
Declare a scheme this crate does not implement. The host parses and reads it; this only teaches help and validation that it exists.
pub fn schemes(&self) -> &[SourceScheme]
pub fn host_schemes(&self) -> &[HostScheme]
pub fn accepts(&self, scheme: SourceScheme) -> bool
pub fn is_empty(&self) -> bool
Sourcepub fn syntax_summary(&self) -> String
pub fn syntax_summary(&self) -> String
The syntax line help and --docs render, so an about string never
has to repeat it.
Sourcepub fn parse(&self, raw: &str) -> Result<ValueSource, SourceError>
pub fn parse(&self, raw: &str) -> Result<ValueSource, SourceError>
Classify one argument value. Pure: nothing is opened, read, or asked for, so an argv that names an unacceptable source is rejected as a usage error before any of it can happen.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SourceSet
impl<'de> Deserialize<'de> for SourceSet
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>,
impl Eq for SourceSet
impl StructuralPartialEq for SourceSet
Auto Trait Implementations§
impl Forget for SourceSet
impl Freeze for SourceSetwhere
*const u8 is !null: Freeze,
PhantomData<SourceScheme>: Freeze,
PhantomData<HostScheme>: Freeze,
impl Move for SourceSet
impl RefUnwindSafe for SourceSet
impl Send for SourceSetwhere
RawVecInner: Send,
impl Sync for SourceSetwhere
RawVecInner: Sync,
impl Unpin for SourceSet
impl UnsafeUnpin for SourceSetwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<SourceScheme>: UnsafeUnpin,
PhantomData<HostScheme>: UnsafeUnpin,
impl UnwindSafe for SourceSetwhere
RawVecInner: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.