Skip to content
Prev Previous commit
Next Next commit
Impl TypeInfo for Path
  • Loading branch information
ascjones committed Sep 9, 2020
commit 477ff965ef9911934f38a360b7d13d8930aeb44a
17 changes: 11 additions & 6 deletions src/ty/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{
form::{CompactForm, Form, MetaForm},
tm_std::*,
utils::is_rust_identifier,
IntoCompact, Registry,
};
use crate::{build::Fields, form::{CompactForm, Form, MetaForm}, tm_std::*, utils::is_rust_identifier, IntoCompact, Registry, TypeInfo, Type};
use scale::{Decode, Encode};
use serde::{de::DeserializeOwned, Deserialize, Serialize};

Expand Down Expand Up @@ -58,6 +53,16 @@ impl IntoCompact for Path {
}
}

impl TypeInfo for Path<CompactForm> {
fn type_info() -> Type<MetaForm> {
Type::builder()
.path(Path::prelude("Path"))
.composite(
Fields::named().field_of::<Vec<<CompactForm as Form>::String>>("segments")
)
}
}

impl Path {
/// Create a new Path
///
Expand Down