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

Method file

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

Create a new file item. # Arguments `path` - Path relative to repository root `inode` - File's stable identifier `position` - Root position in the graph # Example ```rust use atomic_core::output::repo::TreeItem; use atomic_core::types::{Inode, Position}; let item = TreeItem::file("src/main.rs", Inode::ROOT, Position::ROOT); assert_eq!(item.path, "src/main.rs"); assert!(!item.is_directory); ``

(path: impl Into<String>, inode: Inode, position: Position<NodeId>)

Source from the content-addressed store, hash-verified

509 /// assert!(!item.is_directory);
510 /// ```
511 pub fn file(path: impl Into<String>, inode: Inode, position: Position<NodeId>) -> Self {
512 let path = path.into();
513 let depth = TreeCollectOptions::path_depth(&path);
514 Self {
515 path,
516 inode,
517 position,
518 is_directory: false,
519 metadata: FileMetadata::file(),
520 depth,
521 }
522 }
523
524 /// Create a new directory item.
525 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected