Add examples to Signature::new.

This commit is contained in:
Sergey Pepyakin 2018-03-29 17:12:38 +03:00
parent ade9b32d1c
commit c8ff919c5c
1 changed files with 16 additions and 0 deletions

View File

@ -20,6 +20,22 @@ pub struct Signature {
impl Signature {
/// Creates new signature with givens
/// parameter types and optional return type.
///
/// # Examples
///
/// ```rust
/// use wasmi::{Signature, ValueType};
///
/// // s1: (i32) -> ()
/// let s1 = Signature::new(&[ValueType::I32][..], None);
///
/// // s2: () -> i32
/// let s2 = Signature::new(&[][..], Some(ValueType::I32));
///
/// // s3: (I64) -> ()
/// let dynamic_params = vec![ValueType::I64];
/// let s3 = Signature::new(dynamic_params, None);
/// ```
pub fn new<C: Into<Cow<'static, [ValueType]>>>(
params: C,
return_type: Option<ValueType>