-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
2,199 additions
and
2,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
use clipboard_rs::{Clipboard, ClipboardContext}; | ||
|
||
fn main() { | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
|
||
let buffer = ctx.get_buffer("public.html").unwrap(); | ||
let buffer = ctx.get_buffer("public.html").unwrap(); | ||
|
||
let string = String::from_utf8(buffer).unwrap(); | ||
let string = String::from_utf8(buffer).unwrap(); | ||
|
||
println!("{}", string); | ||
println!("{}", string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
use clipboard_rs::{Clipboard, ClipboardContext, ContentFormat}; | ||
|
||
fn main() { | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let ctx = ClipboardContext::new().unwrap(); | ||
|
||
// change the file paths to your own | ||
// let files = vec![ | ||
// "file:///home/parallels/clipboard-rs/Cargo.toml".to_string(), | ||
// "file:///home/parallels/clipboard-rs/CHANGELOG.md".to_string(), | ||
// ]; | ||
// change the file paths to your own | ||
// let files = vec![ | ||
// "file:///home/parallels/clipboard-rs/Cargo.toml".to_string(), | ||
// "file:///home/parallels/clipboard-rs/CHANGELOG.md".to_string(), | ||
// ]; | ||
|
||
// ctx.set_files(files).unwrap(); | ||
// ctx.set_files(files).unwrap(); | ||
|
||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
|
||
let has = ctx.has(ContentFormat::Files); | ||
println!("has_files={}", has); | ||
let has = ctx.has(ContentFormat::Files); | ||
println!("has_files={}", has); | ||
|
||
let files = ctx.get_files().unwrap(); | ||
println!("{:?}", files); | ||
let files = ctx.get_files().unwrap(); | ||
println!("{:?}", files); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
use clipboard_rs::{Clipboard, ClipboardContext, ContentFormat}; | ||
|
||
fn main() { | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
|
||
let has_rtf = ctx.has(ContentFormat::Rtf); | ||
println!("has_rtf={}", has_rtf); | ||
let has_rtf = ctx.has(ContentFormat::Rtf); | ||
println!("has_rtf={}", has_rtf); | ||
|
||
let rtf = ctx.get_rich_text().unwrap(); | ||
let rtf = ctx.get_rich_text().unwrap(); | ||
|
||
println!("rtf={}", rtf); | ||
println!("rtf={}", rtf); | ||
|
||
let has_html = ctx.has(ContentFormat::Html); | ||
println!("has_html={}", has_html); | ||
let has_html = ctx.has(ContentFormat::Html); | ||
println!("has_html={}", has_html); | ||
|
||
let html = ctx.get_html().unwrap(); | ||
let html = ctx.get_html().unwrap(); | ||
|
||
println!("html={}", html); | ||
println!("html={}", html); | ||
|
||
let content = ctx.get_text().unwrap(); | ||
let content = ctx.get_text().unwrap(); | ||
|
||
println!("txt={}", content); | ||
println!("txt={}", content); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
use clipboard_rs::{common::RustImage, Clipboard, ClipboardContext}; | ||
|
||
fn main() { | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
|
||
let img = ctx.get_image().unwrap(); | ||
let img = ctx.get_image().unwrap(); | ||
|
||
img.save_to_path("/tmp/test.png").unwrap(); | ||
img.save_to_path("/tmp/test.png").unwrap(); | ||
|
||
let resize_img = img.thumbnail(300, 300).unwrap(); | ||
let resize_img = img.thumbnail(300, 300).unwrap(); | ||
|
||
resize_img.save_to_path("/tmp/test_thumbnail.png").unwrap(); | ||
resize_img.save_to_path("/tmp/test_thumbnail.png").unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
use clipboard_rs::{ | ||
common::ContentData, Clipboard, ClipboardContent, ClipboardContext, ContentFormat, | ||
common::ContentData, Clipboard, ClipboardContent, ClipboardContext, ContentFormat, | ||
}; | ||
|
||
fn main() { | ||
let ctx = ClipboardContext::new().unwrap(); | ||
let ctx = ClipboardContext::new().unwrap(); | ||
|
||
let contents: Vec<ClipboardContent> = vec![ | ||
ClipboardContent::Text("hell@$#%^&U都98好的😊o Rust!!!".to_string()), | ||
ClipboardContent::Rtf("\x1b[1m\x1b[4m\x1b[31mHello, Rust!\x1b[0m".to_string()), | ||
ClipboardContent::Html("<html><body><h1>Hello, Rust!</h1></body></html>".to_string()), | ||
]; | ||
let contents: Vec<ClipboardContent> = vec![ | ||
ClipboardContent::Text("hell@$#%^&U都98好的😊o Rust!!!".to_string()), | ||
ClipboardContent::Rtf("\x1b[1m\x1b[4m\x1b[31mHello, Rust!\x1b[0m".to_string()), | ||
ClipboardContent::Html("<html><body><h1>Hello, Rust!</h1></body></html>".to_string()), | ||
]; | ||
|
||
ctx.set(contents).unwrap(); | ||
ctx.set(contents).unwrap(); | ||
|
||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
let types = ctx.available_formats().unwrap(); | ||
println!("{:?}", types); | ||
|
||
let read = ctx | ||
.get(&[ContentFormat::Text, ContentFormat::Rtf, ContentFormat::Html]) | ||
.unwrap(); | ||
let read = ctx | ||
.get(&[ContentFormat::Text, ContentFormat::Rtf, ContentFormat::Html]) | ||
.unwrap(); | ||
|
||
for c in read { | ||
println!("{}", c.as_str().unwrap()); | ||
} | ||
for c in read { | ||
println!("{}", c.as_str().unwrap()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hard_tabs = true | ||
use_field_init_shorthand = true | ||
use_try_shorthand = true | ||
reorder_imports = true |
Oops, something went wrong.