Skip to content

Commit

Permalink
[autosync] Fix docs for aws_smithy_types::Number converters (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-perez authored and jdisanti committed Mar 17, 2022
1 parent 4affc2a commit d53c304
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .smithyrs-githash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
107194f106a736426caccbd158e9fb756584ceb0
c059491a32e3c1aa5529c74d5c9f0f2b02fa5494
10 changes: 8 additions & 2 deletions sdk/aws-smithy-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ pub enum Number {
}

macro_rules! to_num_fn {
($name:ident, $typ:ident) => {
/// Converts to a `$typ`. This conversion may be lossy.
($name:ident, $typ:ident, $styp:expr) => {
#[doc = "Converts to a `"]
#[doc = $styp]
#[doc = "`. This conversion may be lossy."]
pub fn $name(self) -> $typ {
match self {
Number::PosInt(val) => val as $typ,
Expand All @@ -99,6 +101,10 @@ macro_rules! to_num_fn {
}
}
};

($name:ident, $typ:ident) => {
to_num_fn!($name, $typ, stringify!($typ));
};
}

impl Number {
Expand Down

0 comments on commit d53c304

Please sign in to comment.