Skip to content

Commit fdcfc50

Browse files
committed
[Perf] add examples for codesnap library
1 parent 0e44d20 commit fdcfc50

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
File renamed without changes.

core/examples/simple.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use codesnap::config::{CodeBuilder, CodeSnap, Content};
2+
3+
pub fn main() -> anyhow::Result<()> {
4+
let code_content = Content::Code(
5+
CodeBuilder::default()
6+
.content(r#"print "Hello, World!""#)
7+
.language("python")
8+
.build()?,
9+
);
10+
11+
let snapshot = CodeSnap::default()
12+
.content(code_content)
13+
.build()?
14+
.create_snapshot()?;
15+
16+
// Copy the snapshot data to the clipboard
17+
snapshot.raw_data()?.copy()
18+
}

0 commit comments

Comments
 (0)