leaf_protocol/components.rs
1//! Common Leaf components.
2
3use borsh::{BorshDeserialize, BorshSerialize};
4use leaf_protocol_macros::HasBorshSchema;
5
6use crate::{
7 types::{BorshSchema, HasBorshSchema},
8 Component, Digest,
9};
10
11/// The `UTF-8` component. The most fundamental component, which is primarily used for documenting
12/// other component specifications.
13#[derive(BorshDeserialize, BorshSerialize, Component, HasBorshSchema, Debug)]
14#[component(
15 name = "UTF-8",
16 schema_id = "2q5uytuwznlk6krd7ugl65gq2eokpbo3e5i6wq5ftmzv27opk6pq"
17)]
18pub struct Utf8(pub String);
19
20#[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
21#[component(
22 schema_id = "znqyvzghvyafsj6n5wyhgl7mspy3swlofxeh2nattvtql5amtcda",
23 no_compute_schema_id
24)]
25pub struct Name(pub String);
26
27#[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
28#[component(
29 schema_id = "bt6wzovlhtmwnqk4o4pqpfutjkakfzaglvhg4pd26mmp3sgakg3a",
30 no_compute_schema_id
31)]
32pub struct Description(pub String);
33
34// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
35// #[component(
36// specification = "leaf-schemas/DateCreated",
37// schema_id = "6qrsqqeso44tmy4y2gpmb7o4x2j3kdzjeuypfnpvmc74zahhsiwa"
38// )]
39// pub struct DateCreated(pub u64);
40
41// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
42// #[component(
43// specification = "leaf-schemas/DateUpdated",
44// schema_id = "3qdqzps5y3zu4sc4vc737xkwzl6va2vatcmtxplgruu2fd4joeqq"
45// )]
46// pub struct DateUpdated(pub u64);
47
48// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
49// #[component(
50// specification = "leaf-schemas/CommonMark",
51// schema_id = "uy5tkom2uchinxo5pyouwwobj4efhsvw7bws2rjkobl66je7cnbq"
52// )]
53// pub struct CommonMark(pub u64);
54
55// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
56// #[component(
57// specification = "leaf-schemas/ReplyTo",
58// schema_id = "wodv3ehssd64ooyl7bgzocbyvznihzranh4b5lgi6e7uh6wvbczq"
59// )]
60// pub struct ReplyTo(pub Link);
61
62// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
63// #[component(
64// specification = "leaf-schemas/Embed",
65// schema_id = "wvnxhyf4p3ido3pfvvfjth4g3qt7sjusf3plfrqpo44l7o6cfa4a"
66// )]
67// pub struct Embed(pub Link);
68
69// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Component, Debug)]
70// #[component(
71// specification = "leaf-schemas/Image",
72// schema_id = "b7yadsp7e2lt6swf7d6lc6e4244h2xk327k3aekzafcp4jnxi2jq"
73// )]
74// pub struct Image {
75// mime_type: String,
76// size: ImageSize,
77// data: Blob,
78// }
79
80// #[derive(BorshDeserialize, BorshSerialize, HasBorshSchema, Debug)]
81// pub struct ImageSize {
82// width: u32,
83// height: u32,
84// }