Skip to content

Commit 2f1fba9

Browse files
committed
IPLD support.
1 parent ae32fae commit 2f1fba9

File tree

8 files changed

+159
-2
lines changed

8 files changed

+159
-2
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"editor.formatOnSave": true,
33
"rust-analyzer.cargo.features": [
4-
"pulldown-cmark"
4+
"libipld-core",
5+
"cid"
56
]
67
}

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ smallvec = { version = "1.9.0", optional = true }
2929
syn = { version = "1.0.98", features = ["full"], optional = true }
3030
ungrammar = { version = "1.16.1", optional = true }
3131
pulldown-cmark = { version = "0.9.2", optional = true, default-features = false }
32+
libipld-core = { version = "0.16.0", optional = true }
33+
cid = { version = "0.10.1", optional = true }
3234

3335
[features]
3436
kdl = ["dep:kdl", "miette"] # KDL's error has miette
3537
syn = ["dep:syn", "proc-macro2"] # Syn's Ident has proc-macro2
3638
aws-sdk-ec2 = ["dep:aws-sdk-ec2", "aws-smithy-types"] # AWS crates use aws-smithy-types as core.
39+
libipld-core = ["dep:libipld-core", "cid"]
40+
cid = ["dep:cid"]
3741

3842
[workspace]
3943
members = [

generator/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ exclude = ["KdlValue"] # We can be cleverer
2727
[miette]
2828
[rustdoc-types]
2929
[smallvec]
30-
[ungrammar]
30+
[ungrammar]
31+
[libipld-core]

generator/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ fn do_package(
8888
"--features",
8989
// FIXME: Don't name features after packages, to allow syn1 and syn2
9090
&package,
91+
// No-one has the git resistry these days
92+
"-Z",
93+
"sparse-registry",
9194
"--",
9295
"-w",
9396
"json",

src/gen_impls/libipld_core.rs

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
// AUTOGENERATED FILE, DO NOT EDIT
2+
//
3+
// Crate Name: `libipld_core`
4+
// Crate Version: `0.16.0`
5+
impl crate::Debug for libipld_core::error::BlockNotFound {
6+
fn fmt(&self, f: &mut crate::Formatter) {
7+
f.debug_tuple("BlockNotFound").field(&self.0).finish()
8+
}
9+
}
10+
impl crate::Debug for libipld_core::error::BlockTooLarge {
11+
fn fmt(&self, f: &mut crate::Formatter) {
12+
f.debug_tuple("BlockTooLarge").field(&self.0).finish()
13+
}
14+
}
15+
impl crate::Debug for libipld_core::error::InvalidMultihash {
16+
fn fmt(&self, f: &mut crate::Formatter) {
17+
f.debug_tuple("InvalidMultihash").field(&self.0).finish()
18+
}
19+
}
20+
impl crate::Debug for libipld_core::error::TypeError {
21+
fn fmt(&self, f: &mut crate::Formatter) {
22+
f.debug_struct("TypeError")
23+
.field("expected", &self.expected)
24+
.field("found", &self.found)
25+
.finish()
26+
}
27+
}
28+
impl crate::Debug for libipld_core::error::TypeErrorType {
29+
fn fmt(&self, f: &mut crate::Formatter) {
30+
match self {
31+
Self::Null => {
32+
f.debug_tuple("Null").finish();
33+
}
34+
Self::Bool => {
35+
f.debug_tuple("Bool").finish();
36+
}
37+
Self::Integer => {
38+
f.debug_tuple("Integer").finish();
39+
}
40+
Self::Float => {
41+
f.debug_tuple("Float").finish();
42+
}
43+
Self::String => {
44+
f.debug_tuple("String").finish();
45+
}
46+
Self::Bytes => {
47+
f.debug_tuple("Bytes").finish();
48+
}
49+
Self::List => {
50+
f.debug_tuple("List").finish();
51+
}
52+
Self::Map => {
53+
f.debug_tuple("Map").finish();
54+
}
55+
Self::Link => {
56+
f.debug_tuple("Link").finish();
57+
}
58+
Self::Key(__0) => {
59+
f.debug_tuple("Key").field(__0).finish();
60+
}
61+
Self::Index(__0) => {
62+
f.debug_tuple("Index").field(__0).finish();
63+
}
64+
}
65+
}
66+
}
67+
impl crate::Debug for libipld_core::error::UnsupportedCodec {
68+
fn fmt(&self, f: &mut crate::Formatter) {
69+
f.debug_tuple("UnsupportedCodec").field(&self.0).finish()
70+
}
71+
}
72+
impl crate::Debug for libipld_core::error::UnsupportedMultihash {
73+
fn fmt(&self, f: &mut crate::Formatter) {
74+
f.debug_tuple("UnsupportedMultihash")
75+
.field(&self.0)
76+
.finish()
77+
}
78+
}
79+
impl crate::Debug for libipld_core::ipld::Ipld {
80+
fn fmt(&self, f: &mut crate::Formatter) {
81+
match self {
82+
Self::Null => {
83+
f.debug_tuple("Null").finish();
84+
}
85+
Self::Bool(__0) => {
86+
f.debug_tuple("Bool").field(__0).finish();
87+
}
88+
Self::Integer(__0) => {
89+
f.debug_tuple("Integer").field(__0).finish();
90+
}
91+
Self::Float(__0) => {
92+
f.debug_tuple("Float").field(__0).finish();
93+
}
94+
Self::String(__0) => {
95+
f.debug_tuple("String").field(__0).finish();
96+
}
97+
Self::Bytes(__0) => {
98+
f.debug_tuple("Bytes").field(__0).finish();
99+
}
100+
Self::List(__0) => {
101+
f.debug_tuple("List").field(__0).finish();
102+
}
103+
Self::Map(__0) => {
104+
f.debug_tuple("Map").field(__0).finish();
105+
}
106+
Self::Link(__0) => {
107+
f.debug_tuple("Link").field(__0).finish();
108+
}
109+
}
110+
}
111+
}
112+
impl<'a> crate::Debug for libipld_core::ipld::IpldIndex<'a> {
113+
fn fmt(&self, f: &mut crate::Formatter) {
114+
match self {
115+
Self::List(__0) => {
116+
f.debug_tuple("List").field(__0).finish();
117+
}
118+
Self::Map(__0) => {
119+
f.debug_tuple("Map").field(__0).finish();
120+
}
121+
Self::MapRef(__0) => {
122+
f.debug_tuple("MapRef").field(__0).finish();
123+
}
124+
}
125+
}
126+
}
127+
// Skipping libipld_core::ipld::IpldIter due to hidden fields
128+
// Skipping libipld_core::link::Link due to hidden fields
129+
impl crate::Debug for libipld_core::raw::RawCodec {
130+
fn fmt(&self, f: &mut crate::Formatter) {
131+
f.debug_struct("RawCodec").finish()
132+
}
133+
}
134+
impl crate::Debug for libipld_core::raw_value::IgnoredAny {
135+
fn fmt(&self, f: &mut crate::Formatter) {
136+
f.debug_struct("IgnoredAny").finish()
137+
}
138+
}
139+
// Skipping libipld_core::raw_value::RawValue due to hidden fields

src/gen_impls/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ cfg_mod! {
1212
(smallvec "smallvec")
1313
(syn "syn")
1414
(ungrammar "ungrammar")
15+
(libipld_core "libipld-core")
1516
}

src/hand_impls/cid.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use crate::Debug;
2+
3+
impl<const N: usize> Debug for cid::CidGeneric<N> {
4+
fn fmt(&self, f: &mut crate::Formatter) {
5+
f.debug_tuple("Cid").field(&self.to_string()).finish()
6+
}
7+
}

src/hand_impls/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ cfg_mod! {
1414
(smallvec "smallvec")
1515
(syn "syn")
1616
(ungrammar "ungrammar")
17+
(cid "cid")
1718
}

0 commit comments

Comments
 (0)