Skip to content

Commit

Permalink
Implement unix fs ops
Browse files Browse the repository at this point in the history
  • Loading branch information
appcypher committed Apr 14, 2022
1 parent 2547c39 commit 14d8eb4
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 78 deletions.
1 change: 1 addition & 0 deletions crates/fs/common/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub enum FsError {
NotADirectory,
NotFound,
FileAlreadyExists,
DirectoryAlreadyExists,
UndecodableCborData(String),
}

Expand Down
15 changes: 15 additions & 0 deletions crates/fs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod common;
pub mod public;

pub use common::*;
pub use utils::*;

//--------------------------------------------------------------------------------------------------
// Re-exports
Expand All @@ -13,3 +14,17 @@ pub use libipld::{
codec::{Decode, Encode},
Cid, IpldCodec,
};

//--------------------------------------------------------------------------------------------------
// Utils
//--------------------------------------------------------------------------------------------------

mod utils {
use std::{cell::RefCell, rc::Rc};

pub type Shared<T> = Rc<RefCell<T>>;

pub fn shared<T>(t: T) -> Shared<T> {
Rc::new(RefCell::new(t))
}
}
Loading

0 comments on commit 14d8eb4

Please sign in to comment.