Skip to content

Commit

Permalink
adapt changes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xermicus committed Sep 8, 2022
1 parent 38f3c04 commit cfa5ce9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
18 changes: 10 additions & 8 deletions crates/metadata/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl LayoutKey {
/// Construct a custom layout key.
pub fn new<T>(key: T) -> Self
where
T: Into<[u8; 32]>,
T: Into<u32>,
{
Self { key: key.into() }
}
Expand Down Expand Up @@ -465,11 +465,13 @@ where
F: Form,
{
/// Creates a new struct layout.
pub fn new<T>(fields: T) -> Self
pub fn new<N, T>(name: N, fields: T) -> Self
where
N: Into<F::String>,
T: IntoIterator<Item = FieldLayout<F>>,
{
Self {
name: name.into(),
fields: fields.into_iter().collect(),
}
}
Expand Down Expand Up @@ -519,11 +521,11 @@ impl FieldLayout {
/// Creates a new field layout.
pub fn new<'a, N, L>(name: N, layout: L) -> Self
where
N: Into<Option<&'a str>>,
N: Into<&'a str>,
L: Into<Layout>,
{
Self {
name: name.into().map(ToString::to_string),
name: name.into().to_string(),
layout: layout.into(),
}
}
Expand Down Expand Up @@ -558,7 +560,7 @@ where
/// Creates a new custom field layout.
pub fn new_custom<N, L>(name: N, layout: L) -> Self
where
N: Into<Option<F::String>>,
N: Into<F::String>,
L: Into<Layout<F>>,
{
Self {
Expand Down Expand Up @@ -626,14 +628,14 @@ pub struct EnumLayout<F: Form = MetaForm> {

impl EnumLayout {
/// Creates a new enum layout.
pub fn new<N, K, V>(name: N, dispatch_key: K, variants: V) -> Self
pub fn new<'a, N, K, V>(name: N, dispatch_key: K, variants: V) -> Self
where
N: Into<&'static str>,
N: Into<&'a str>,
K: Into<LayoutKey>,
V: IntoIterator<Item = (Discriminant, StructLayout)>,
{
Self {
name: name.into(),
name: name.into().to_string(),
dispatch_key: dispatch_key.into(),
variants: variants.into_iter().collect(),
}
Expand Down
1 change: 1 addition & 0 deletions crates/metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl InkProject {
registry: PortableRegistry,
) -> Self {
Self {
version: Default::default(),
layout,
spec,
registry,
Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/src/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ where
debug_assert!(this.spec.docs.is_empty());
this.spec.docs = docs
.into_iter()
.map(|s| s.trim().to_string())
.map(|s| trim_extra_whitespace(s).to_string())
.collect::<Vec<_>>();
this
}
Expand Down

0 comments on commit cfa5ce9

Please sign in to comment.