Enum broot::tree::TreeLineType

source ·
pub enum TreeLineType {
    File,
    Dir,
    BrokenSymLink(String),
    SymLink {
        direct_target: String,
        final_is_dir: bool,
        final_target: PathBuf,
    },
    Pruning,
}
Expand description

The type of a line which can be displayed as part of a tree

Variants§

§

File

§

Dir

Fields

§direct_target: String
§final_is_dir: bool
§final_target: PathBuf
§

Pruning

Implementations§

Examples found in repository?
src/tree_build/bline.rs (line 123)
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    pub fn to_tree_line(&self, bid: BId, con: &AppContext) -> std::io::Result<TreeLine> {
        let has_error = self.has_error;
        let line_type = TreeLineType::new(&self.path, &self.file_type);
        let unlisted = if let Some(children) = &self.children {
            // number of not listed children
            children.len() - self.next_child_idx
        } else {
            0
        };
        let metadata = fs::symlink_metadata(&self.path)?;
        let subpath = self.subpath.replace('\n', "");
        let name = self.name.replace('\n', "");
        let icon = con.icons.as_ref()
            .map(|icon_plugin| {
                let extension = TreeLine::extension_from_name(&name);
                let double_extension = extension
                    .and_then(|_| TreeLine::double_extension_from_name(&name));
                icon_plugin.get_icon(
                    &line_type,
                    &name,
                    double_extension,
                    extension,
                )
            });

        Ok(TreeLine {
            bid,
            parent_bid: self.parent_id,
            left_branchs: vec![false; self.depth as usize].into_boxed_slice(),
            depth: self.depth,
            icon,
            name,
            subpath,
            path: self.path.clone(),
            line_type,
            has_error,
            nb_kept_children: self.nb_kept_children as usize,
            unlisted,
            score: self.score,
            direct_match: self.direct_match,
            sum: None,
            metadata,
            git_status: None,
        })
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.