-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreference.txt
72 lines (57 loc) · 1.11 KB
/
reference.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
extern crate brotli;
struct PrintAsDecimal {
}
impl Write for PrintAsDecimal {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
for x in buf
{
println!("{}", x);
}
Ok(buf.len())
}
fn flush(&mut self) -> Result<(), std::io::Error> {
Ok(())
}
}
impl Read for PrintAsDecimal {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
let size = buf.len();
for x in buf
{
println!("{}", x);
}
Ok(size)
}
}
struct User {
username: String,
count: u32,
}
impl User {
fn printName(&self){
println!("{}",self.username);
}
}
fn build_user(count: u32) -> User
{
let original_user = User {
username: String::from("test"),
count,
};
User {
count: 42,
..original_user
}
}
fn main() {
use std::io;
use std::io::{Write};
let stdout = &mut io::stdout();
let mut writer = brotli::CompressorWriter::new(
stdout,
4096,
11,
22);
let buf = [0u8; 4096];
writer.write_all(&buf);
}