Skip to content

Commit 99fcfc9

Browse files
committed
Add rust
1 parent 305b50c commit 99fcfc9

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

docs/tasks/build.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import TabItem from '@theme/TabItem';
1616
This is how to build a manifest using C++.
1717
</TabItem>
1818

19-
<TabItem value="node" label="Node.js">
20-
This is how to build a manifest using Node.js.
19+
{' '}
20+
<TabItem value="node" label="Node.js">
21+
This is how to build a manifest using Node.js.
22+
</TabItem>
23+
24+
<TabItem value="rust" label="Rust">
25+
This is how to build a manifest using Rust.
2126
</TabItem>
27+
2228
</Tabs>

docs/tasks/get-resources.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ except Exception as err:
4242
This is how to get resources from a manifest using C++.
4343
</TabItem>
4444

45-
<TabItem value="node" label="Node.js">
46-
This is how to get resources from a manifest using Node.js.
47-
</TabItem>
45+
{' '}
46+
<TabItem value="node" label="Node.js">
47+
This is how to get resources from a manifest using Node.js.
48+
</TabItem>
49+
50+
{' '}
51+
<TabItem value="rust" label="Rust">
52+
This is how to get resources using Rust.
53+
</TabItem>
54+
4855
</Tabs>

docs/tasks/read.mdx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: read
33
title: Reading manifest data
4+
hide_table_of_contents: true
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -57,17 +58,13 @@ try:
5758
# Create a reader from a file path
5859
reader = c2pa.Reader.from_file("path/to/media_file.jpg")
5960

61+
# Alternatively, create a reader from a stream
62+
stream = open("path/to/media_file.jpg", "rb")
63+
reader = c2pa.Reader("image/jpeg", stream)
64+
6065
# Print the JSON for a manifest.
6166
print("manifest store:", reader.json())
6267

63-
# Get the active manifest.
64-
manifest = reader.get_active_manifest()
65-
if manifest != None:
66-
67-
# Get the URI to the manifest's thumbnail and write it to a file
68-
uri = manifest["thumbnail"]["identifier"]
69-
reader.resource_to_file(uri, "thumbnail_v2.jpg")
70-
7168
except Exception as err:
7269
print(err)
7370
```
@@ -103,7 +100,7 @@ await read('my-c2pa-file.jpg', 'image/jpeg');
103100
104101
<TabItem value="cpp" label="C++">
105102
106-
Use the `read_file` function to read C2PA data from the specified file. This function examines the specified asset file for C2PA data and its return value is a JSON report if it finds C2PA data. If there are validation errors, the report includes a `validation_status` field. Exceptions are thrown on errors.
103+
Use the `read_file` function to read C2PA data from the specified file. This function examines the specified asset file for C2PA data and returns a JSON report if it finds any; it throws exceptions on errors. If there are validation errors, the report includes a `validation_status` field.
107104
108105
```cpp
109106
auto json_store = C2pa::read_file("<ASSET_FILE>", "<DATA_DIR>")

docs/tasks/sign.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import TabItem from '@theme/TabItem';
1515
This is how to sign a manifest using C++.
1616
</TabItem>
1717

18-
<TabItem value="node" label="Node.js">
19-
This is how to sign a manifest using Node.js.
18+
{' '}
19+
<TabItem value="node" label="Node.js">
20+
This is how to sign a manifest using Node.js.
21+
</TabItem>
22+
23+
<TabItem value="rust" label="Rust">
24+
This is how to sign a manifest using Rust.
2025
</TabItem>
26+
2127
</Tabs>

docs/tasks/write.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import TabItem from '@theme/TabItem';
1515
This is how to write a manifest using C++.
1616
</TabItem>
1717

18-
<TabItem value="node" label="Node.js">
19-
This is how to write a manifest using Node.js.
18+
{' '}
19+
<TabItem value="node" label="Node.js">
20+
This is how to write a manifest using Node.js.
21+
</TabItem>
22+
23+
<TabItem value="rust" label="Rust">
24+
This is how to write a manifest using Rust.
2025
</TabItem>
2126
</Tabs>

0 commit comments

Comments
 (0)