MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / filename

Method filename

atomic-core/src/output/repo/tree.rs:600–602  ·  view source on GitHub ↗

Get the filename (last component of path). # Returns The filename without the directory path. # Example ```rust use atomic_core::output::repo::TreeItem; use atomic_core::types::{Inode, Position}; let item = TreeItem::file("src/lib/mod.rs", Inode::ROOT, Position::ROOT); assert_eq!(item.filename(), "mod.rs"); ```

(&self)

Source from the content-addressed store, hash-verified

598 /// assert_eq!(item.filename(), "mod.rs");
599 /// ```
600 pub fn filename(&self) -> &str {
601 self.path.rsplit('/').next().unwrap_or(&self.path)
602 }
603
604 /// Get the parent directory path.
605 ///

Callers 1

is_hiddenMethod · 0.80

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected