Enum nu_protocol::PositionalType
source · [−]pub enum PositionalType {
Mandatory(String, SyntaxShape),
Optional(String, SyntaxShape),
}
Expand description
The type of positional arguments
Variants
Mandatory(String, SyntaxShape)
A mandatory positional argument with the expected shape of the value
Optional(String, SyntaxShape)
An optional positional argument with the expected shape of the value
Implementations
sourceimpl PositionalType
impl PositionalType
sourcepub fn mandatory(name: &str, ty: SyntaxShape) -> PositionalType
pub fn mandatory(name: &str, ty: SyntaxShape) -> PositionalType
Helper to create a mandatory positional argument type
sourcepub fn mandatory_any(name: &str) -> PositionalType
pub fn mandatory_any(name: &str) -> PositionalType
Helper to create a mandatory positional argument with an “any” type
sourcepub fn mandatory_block(name: &str) -> PositionalType
pub fn mandatory_block(name: &str) -> PositionalType
Helper to create a mandatory positional argument with a block type
sourcepub fn optional(name: &str, ty: SyntaxShape) -> PositionalType
pub fn optional(name: &str, ty: SyntaxShape) -> PositionalType
Helper to create a optional positional argument type
sourcepub fn optional_any(name: &str) -> PositionalType
pub fn optional_any(name: &str) -> PositionalType
Helper to create a optional positional argument with an “any” type
sourcepub fn syntax_type(&self) -> SyntaxShape
pub fn syntax_type(&self) -> SyntaxShape
Gets the expected type of a positional argument
pub fn get_type_description(&self) -> (String, String)
Trait Implementations
sourceimpl Clone for PositionalType
impl Clone for PositionalType
sourcefn clone(&self) -> PositionalType
fn clone(&self) -> PositionalType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PositionalType
impl Debug for PositionalType
sourceimpl<'de> Deserialize<'de> for PositionalType
impl<'de> Deserialize<'de> for PositionalType
sourcefn 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
sourceimpl PartialEq<PositionalType> for PositionalType
impl PartialEq<PositionalType> for PositionalType
sourcefn eq(&self, other: &PositionalType) -> bool
fn eq(&self, other: &PositionalType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PositionalType) -> bool
fn ne(&self, other: &PositionalType) -> bool
This method tests for !=
.
sourceimpl PrettyDebug for PositionalType
impl PrettyDebug for PositionalType
sourcefn pretty(&self) -> DebugDocBuilder
fn pretty(&self) -> DebugDocBuilder
Prepare the PositionalType for pretty-printing
fn to_doc(&self) -> DebugDoc
fn pretty_doc(
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>
sourcefn display(&self) -> String
fn display(&self) -> String
A convenience method that prints out the document without colors in 70 columns. Generally, you should use plain_string or colored_string if possible, but display() can be useful for trace lines and things like that, where you don’t have control over the terminal. Read more
fn plain_string(&self, width: usize) -> String
fn colored_string(&self, width: usize) -> String
sourceimpl Serialize for PositionalType
impl Serialize for PositionalType
impl Eq for PositionalType
impl StructuralEq for PositionalType
impl StructuralPartialEq for PositionalType
Auto Trait Implementations
impl RefUnwindSafe for PositionalType
impl Send for PositionalType
impl Sync for PositionalType
impl Unpin for PositionalType
impl UnwindSafe for PositionalType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> PrettyDebugWithSource for T where
T: PrettyDebug,
impl<T> PrettyDebugWithSource for T where
T: PrettyDebug,
pub fn pretty_debug(&self, _source: &str) -> DebugDocBuilder
fn refined_pretty_debug(
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder
fn debug(&self, source: impl Into<Text>) -> String where
Self: Clone,
fn debuggable(self, source: impl Into<Text>) -> DebuggableWithSource<Self>
sourceimpl<T> SpannedItem for T
impl<T> SpannedItem for T
sourceimpl<T> TaggedItem for T
impl<T> TaggedItem for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more