Struct broot::filesystems::MountSpaceDisplay
source · pub struct MountSpaceDisplay<'m, 's> {
pub available_width: usize,
/* private fields */
}
Expand description
an abstract of the space info relative to a block device. It’s supposed to be shown on top of screen next to the root.
Fields§
§available_width: usize
Implementations§
source§impl<'m, 's> MountSpaceDisplay<'m, 's>
impl<'m, 's> MountSpaceDisplay<'m, 's>
sourcepub fn from(mount: &'m Mount, skin: &'s StyleMap, available_width: usize) -> Self
pub fn from(mount: &'m Mount, skin: &'s StyleMap, available_width: usize) -> Self
Examples found in repository?
src/display/displayable_tree.rs (lines 423-427)
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
pub fn write_root_line<'w, W: Write>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool,
) -> Result<(), ProgramError> {
cond_bg!(style, self, selected, self.skin.directory);
let line = &self.tree.lines[0];
if self.tree.options.show_sizes {
if let Some(s) = line.sum {
cw.queue_g_string(
style,
format!("{:>4} ", file_size::fit_4(s.to_size())),
)?;
}
}
let title = line.path.to_string_lossy();
cw.queue_str(style, &title)?;
if self.in_app && !cw.is_full() {
if let ComputationResult::Done(git_status) = &self.tree.git_status {
let git_status_display = GitStatusDisplay::from(
git_status,
self.skin,
cw.allowed,
);
git_status_display.write(cw, selected)?;
}
#[cfg(unix)]
if self.tree.options.show_root_fs {
if let Some(mount) = line.mount() {
let fs_space_display = crate::filesystems::MountSpaceDisplay::from(
&mount,
self.skin,
cw.allowed,
);
fs_space_display.write(cw, selected)?;
}
}
self.extend_line_bg(cw, selected)?;
}
Ok(())
}
sourcepub fn write<'w, W>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool
) -> Result<(), ProgramError>where
W: Write,
pub fn write<'w, W>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool
) -> Result<(), ProgramError>where
W: Write,
Examples found in repository?
src/display/displayable_tree.rs (line 428)
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
pub fn write_root_line<'w, W: Write>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool,
) -> Result<(), ProgramError> {
cond_bg!(style, self, selected, self.skin.directory);
let line = &self.tree.lines[0];
if self.tree.options.show_sizes {
if let Some(s) = line.sum {
cw.queue_g_string(
style,
format!("{:>4} ", file_size::fit_4(s.to_size())),
)?;
}
}
let title = line.path.to_string_lossy();
cw.queue_str(style, &title)?;
if self.in_app && !cw.is_full() {
if let ComputationResult::Done(git_status) = &self.tree.git_status {
let git_status_display = GitStatusDisplay::from(
git_status,
self.skin,
cw.allowed,
);
git_status_display.write(cw, selected)?;
}
#[cfg(unix)]
if self.tree.options.show_root_fs {
if let Some(mount) = line.mount() {
let fs_space_display = crate::filesystems::MountSpaceDisplay::from(
&mount,
self.skin,
cw.allowed,
);
fs_space_display.write(cw, selected)?;
}
}
self.extend_line_bg(cw, selected)?;
}
Ok(())
}