Crates.io | encode_rs_fs |
lib.rs | encode_rs_fs |
version | 0.1.3 |
source | src |
created_at | 2022-02-28 05:40:52.722875 |
updated_at | 2022-02-28 08:17:05.99088 |
description | Read and Write files with encoding_rs. |
homepage | |
repository | https://github.com/johnbrandborg/encode_rs_fs |
max_upload_size | |
id | 540659 |
size | 4,917 |
Read and Write files using encodings.
Offical documentation can be found at https://docs.rs/encode_rs_fs
I think I would have preferred the library to be called encoding_rs_fs
, but
once I publishing to crate to crates.io
it was to late, and, it can't be changed.
Add this to your Cargo.toml
:
[dependencies]
encode_rs_fs = "0.1"
and this to your crate root:
extern crate encode_rs_fs;
For a full list of encodings that can be used refer to the documentions at Docs.rs.
Use the functions to read and write entire files using a encoding.
extern crate encodingfs;
use::encode_rs_fs::{read, write};
fn main() {
let test_file = "example.txt";
let source = "ÁáAaBbCc";
let codec = "latin1";
write(test_file, source, codec).unwrap();
let result = read(test_file, codec).unwrap();
println!("Results {:?}", result);
}