Note that try_validation_pat can take a format str directly.
This commit is contained in:
parent
830473959a
commit
bd18ad4fef
1 changed files with 9 additions and 0 deletions
|
@ -66,6 +66,15 @@ macro_rules! try_validation {
|
||||||
/// });
|
/// });
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// An additional nicety is that both parameters actually take format args, so you can just write
|
||||||
|
/// the format string in directly:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let v = try_validation_pat!(some_fn(), some_path, {
|
||||||
|
/// Foo | Bar | Baz => { "{:?}", some_failure } expected { "{}", expected_value },
|
||||||
|
/// });
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
macro_rules! try_validation_pat {
|
macro_rules! try_validation_pat {
|
||||||
($e:expr, $where:expr, { $( $p:pat )|+ =>
|
($e:expr, $where:expr, { $( $p:pat )|+ =>
|
||||||
{ $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? $( , )?}) => {{
|
{ $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? $( , )?}) => {{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue