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

Method filename

atomic-core/src/output/repo/tree.rs:605–607  ·  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

603 /// assert_eq!(item.filename(), "mod.rs");
604 /// ```
605 pub fn filename(&self) -> &str {
606 self.path.rsplit('/').next().unwrap_or(&self.path)
607 }
608
609 /// Get the parent directory path.
610 ///

Callers 1

is_hiddenMethod · 0.80

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected