File: theme.rs

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,245,360 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (44 lines) | stat: -rw-r--r-- 2,017 bytes parent folder | download | duplicates (16)
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
use tabled::{
    settings::{themes::Theme, Style},
    Table, Tabled,
};

#[derive(Tabled)]
struct Concept {
    name: String,
    desc: String,
}

impl Concept {
    fn new(name: &str, desc: &str) -> Self {
        Self {
            name: name.to_string(),
            desc: desc.to_string(),
        }
    }
}

fn main() {
    let data = vec![
        Concept::new("vnode", "A structure representing a filesystem entity like a file, directory, device node, etc at VFS abstraction level"),
        Concept::new("Physical block number", "In the context of FreeBSD filesystems layer we use this term when referring to fixed-size 512-byte blocks"),
        Concept::new("Logical block number", "Typical filesystems have a notion of filesystem blocks which may be constituted of multiple physical (512-byte) or media blocks"),
        Concept::new("Device vnode", "A filesystem is backed by some media that actually contains the data"),
        Concept::new("Buffer cache", "Buffer cache is a layer between filesystems and I/O code that performs actual media access via peripheral drivers"),
        Concept::new("struct bufobj", "struct bufobj represents a set of buffers belonging to the same abstract object"),
        Concept::new("struct buf", "struct buf represents a single buffer. In addition to holding identity of the buffer"),
        Concept::new("bread(9)", "Filesystem use bread (breadn, breada, etc) functions to access underlying data through a buffer cache layer"),
        Concept::new("VOP_BMAP", "VOP_BMAP translates a given logical block number within a given vnode to a physical (512-byte) block number within underlying media"),
        Concept::new("VOP_STRATEGY", "VOP_STRATEGY method fulfills an I/O request described by given struct buf object"),
    ];

    let mut theme = Theme::from_style(Style::ascii());
    theme.reverse_rows(true);
    theme.reverse_columns(true);
    theme.set_footer(true);

    let mut table = Table::new(data);
    table.with(theme);

    println!("{table}");
}