-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#15: 生成したQRコード画像をクリップボードへコピーできるように対応
- Loading branch information
Showing
6 changed files
with
35 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
workspace = { members = [ "qr-code-wrapper" ] } | ||
workspace = { members = ["base64-wrapper", "qr-code-wrapper"] } | ||
|
||
[package] | ||
name = "qr-code-generator-webapp-rust" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
base64-wrapper = { path = "./base64-wrapper" } | ||
qr-code-wrapper = { path = "./qr-code-wrapper" } | ||
web-sys = "0.3.76" | ||
yew = { git = "https://github.com/yewstack/yew/", features = ["csr"] } | ||
yew = { version = "0.21.0", features = ["csr"] } | ||
yew-hooks = "0.3.3" |
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,7 @@ | ||
[package] | ||
name = "base64-wrapper" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
base64 = "0.22.1" |
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,3 @@ | ||
//! This is a library crate for wrapping [`base64`](https://docs.rs/base64/latest/base64/) crate. | ||
pub use base64::*; |
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 |
---|---|---|
|
@@ -4,5 +4,4 @@ version = "0.1.0" | |
edition = "2021" | ||
|
||
[dependencies] | ||
base64 = "0.22.1" | ||
qrcode-generator = "5.0.0" |
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,18 +1,3 @@ | ||
//! This is a library crate for wrapping [`qrcode-generator`](https://docs.rs/qrcode-generator/latest/qrcode_generator/) crate. | ||
extern crate qrcode_generator; | ||
|
||
use base64::{engine::general_purpose::STANDARD, Engine}; | ||
pub use qrcode_generator::*; | ||
|
||
/// Encode text to base64 string of a PNG image in memory. | ||
#[inline] | ||
pub fn to_png_to_base64_str_from_str<S: AsRef<str>>( | ||
text: S, | ||
ecc: QrCodeEcc, | ||
size: usize, | ||
) -> Result<String, QRCodeError> { | ||
let png = to_png_to_vec_from_str(text, ecc, size)?; | ||
let base64_encoded_str = STANDARD.encode(png); | ||
Ok(base64_encoded_str) | ||
} |
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