Struct inapi::Directory
[−]
[src]
pub struct Directory { /* fields omitted */ }
Primitive for managing directories.
Examples
Initialise a new Host:
let mut host = Host::connect("hosts/myhost.json").unwrap();
Now you can setup a directory on your managed host:
let dir = Directory::new(&mut host, "/path/to/dir").unwrap(); dir.create(&mut host, Some(&[DirectoryOpts::DoRecursive])).unwrap(); dir.set_owner(&mut host, "MyUser", "MyGroup").unwrap(); dir.set_mode(&mut host, 755).unwrap();
Methods
impl Directory
[src]
fn new<P: AsRef<Path>>(host: &mut Host, path: P) -> Result<Directory, Error>
[src]
Create a new Directory struct.
fn exists(&self, host: &mut Host) -> Result<bool, Error>
[src]
Check if the directory exists.
fn create(
&self,
host: &mut Host,
options: Option<&[DirectoryOpts]>
) -> Result<(), Error>
[src]
&self,
host: &mut Host,
options: Option<&[DirectoryOpts]>
) -> Result<(), Error>
Create the directory.
fn delete(
&self,
host: &mut Host,
options: Option<&[DirectoryOpts]>
) -> Result<(), Error>
[src]
&self,
host: &mut Host,
options: Option<&[DirectoryOpts]>
) -> Result<(), Error>
Delete the directory.
fn mv<P: AsRef<Path>>(
&mut self,
host: &mut Host,
new_path: P
) -> Result<(), Error>
[src]
&mut self,
host: &mut Host,
new_path: P
) -> Result<(), Error>
Move the directory to a new path.
fn get_owner(&self, host: &mut Host) -> Result<FileOwner, Error>
[src]
Get the directory's owner.
fn set_owner(
&self,
host: &mut Host,
user: &str,
group: &str
) -> Result<(), Error>
[src]
&self,
host: &mut Host,
user: &str,
group: &str
) -> Result<(), Error>
fn get_mode(&self, host: &mut Host) -> Result<u16, Error>
[src]
Get the directory's permissions mask.
fn set_mode(&self, host: &mut Host, mode: u16) -> Result<(), Error>
[src]
Set the directory's permissions mask.