Trait dpdk_unix::PathExt [−][src]
pub trait PathExt { fn to_c_string(&self) -> CString; fn make_file_read_write_all(&self) -> Result<()>; fn make_folder_searchable_to_all(&self) -> Result<()>; fn read_hexadecimal_value_with_prefix<P: Fn(&str) -> Result<T, ParseIntError>, T>(
&self,
size: usize,
parser: P
) -> Result<T>; fn read_raw_string(&self) -> Result<String>; fn read_string_without_line_feed(&self) -> Result<String>; fn read_value<F>(&self) -> Result<F>
where
F: FromStr,
<F as FromStr>::Err: 'static + Send + Sync + Error; fn write_value<D: Display>(&self, value: D) -> Result<()>; fn read_linux_core_or_numa_list<Mapper: Fn(u16) -> R, R: Ord>(
&self,
mapper: Mapper
) -> Result<BTreeSet<R>, ListParseError>; fn parse_linux_core_or_numa_mask(&self) -> Result<u32, Error>; fn parse_virtual_memory_statistics_file(
&self
) -> Result<HashMap<VirtualMemoryStatisticName, u64>>; fn parse_memory_information_file(
&self,
memory_information_name_prefix: &str
) -> Result<MemoryInformation, MemoryInformationParseError>; fn read_hexadecimal_value_with_prefix_u16(&self) -> Result<u16> { ... } }
An extension trait to make it easier to work with sys and proc files and folders.
Required Methods
fn to_c_string(&self) -> CString
Converts a Path
to a CString
.
fn make_file_read_write_all(&self) -> Result<()>
Makes a file read-write to all.
fn make_folder_searchable_to_all(&self) -> Result<()>
Makes a folder searchable to all (ie gives it read and execute permissions).
fn read_hexadecimal_value_with_prefix<P: Fn(&str) -> Result<T, ParseIntError>, T>(
&self,
size: usize,
parser: P
) -> Result<T>
&self,
size: usize,
parser: P
) -> Result<T>
Reads a value from a file which is line-feed terminated and is hexadecimal using a parser.
fn read_raw_string(&self) -> Result<String>
Reads a file as a string.
fn read_string_without_line_feed(&self) -> Result<String>
Reads a file as a string, expecting a final line feed.
The returned string lacks a final line feed.
fn read_value<F>(&self) -> Result<F> where
F: FromStr,
<F as FromStr>::Err: 'static + Send + Sync + Error,
F: FromStr,
<F as FromStr>::Err: 'static + Send + Sync + Error,
Reads a value from a file which is line-feed terminated.
fn write_value<D: Display>(&self, value: D) -> Result<()>
Writes a value to a file which is line-feed terminated.
fn read_linux_core_or_numa_list<Mapper: Fn(u16) -> R, R: Ord>(
&self,
mapper: Mapper
) -> Result<BTreeSet<R>, ListParseError>
&self,
mapper: Mapper
) -> Result<BTreeSet<R>, ListParseError>
Reads and parses a linux core or numa list string from a file.
Returns a BTreeSet with the zero-based indices found in the string. For example, "2,4-31,32-63" would return a set with all values between 0 to 63 except 0, 1 and 3.
fn parse_linux_core_or_numa_mask(&self) -> Result<u32, Error>
Reads and parses a linux core or numa mask string from a file.
fn parse_virtual_memory_statistics_file(
&self
) -> Result<HashMap<VirtualMemoryStatisticName, u64>>
&self
) -> Result<HashMap<VirtualMemoryStatisticName, u64>>
Parses a virtual memory statistics file (vmstat
).
fn parse_memory_information_file(
&self,
memory_information_name_prefix: &str
) -> Result<MemoryInformation, MemoryInformationParseError>
&self,
memory_information_name_prefix: &str
) -> Result<MemoryInformation, MemoryInformationParseError>
Parses a memory information file (meminfo
).
Provided Methods
fn read_hexadecimal_value_with_prefix_u16(&self) -> Result<u16>
Reads a value from a file which is line-feed terminated and is hexadecimal into an u16.
Implementations on Foreign Types
impl PathExt for Path
[src]
impl PathExt for Path
fn to_c_string(&self) -> CString
[src]
fn to_c_string(&self) -> CString
fn make_file_read_write_all(&self) -> Result<()>
[src]
fn make_file_read_write_all(&self) -> Result<()>
fn make_folder_searchable_to_all(&self) -> Result<()>
[src]
fn make_folder_searchable_to_all(&self) -> Result<()>
fn read_hexadecimal_value_with_prefix<P: Fn(&str) -> Result<T, ParseIntError>, T>(
&self,
size: usize,
parser: P
) -> Result<T>
[src]
fn read_hexadecimal_value_with_prefix<P: Fn(&str) -> Result<T, ParseIntError>, T>(
&self,
size: usize,
parser: P
) -> Result<T>
fn read_raw_string(&self) -> Result<String>
[src]
fn read_raw_string(&self) -> Result<String>
fn read_string_without_line_feed(&self) -> Result<String>
[src]
fn read_string_without_line_feed(&self) -> Result<String>
fn read_value<F>(&self) -> Result<F> where
F: FromStr,
<F as FromStr>::Err: 'static + Send + Sync + Error,
[src]
fn read_value<F>(&self) -> Result<F> where
F: FromStr,
<F as FromStr>::Err: 'static + Send + Sync + Error,
fn write_value<D: Display>(&self, value: D) -> Result<()>
[src]
fn write_value<D: Display>(&self, value: D) -> Result<()>
fn read_linux_core_or_numa_list<Mapper: Fn(u16) -> R, R: Ord>(
&self,
mapper: Mapper
) -> Result<BTreeSet<R>, ListParseError>
[src]
fn read_linux_core_or_numa_list<Mapper: Fn(u16) -> R, R: Ord>(
&self,
mapper: Mapper
) -> Result<BTreeSet<R>, ListParseError>
fn parse_linux_core_or_numa_mask(&self) -> Result<u32, Error>
[src]
fn parse_linux_core_or_numa_mask(&self) -> Result<u32, Error>
fn parse_virtual_memory_statistics_file(
&self
) -> Result<HashMap<VirtualMemoryStatisticName, u64>>
[src]
fn parse_virtual_memory_statistics_file(
&self
) -> Result<HashMap<VirtualMemoryStatisticName, u64>>
fn parse_memory_information_file(
&self,
memory_information_name_prefix: &str
) -> Result<MemoryInformation, MemoryInformationParseError>
[src]
fn parse_memory_information_file(
&self,
memory_information_name_prefix: &str
) -> Result<MemoryInformation, MemoryInformationParseError>
Parses the meminfo
file.
fn read_hexadecimal_value_with_prefix_u16(&self) -> Result<u16>
[src]
fn read_hexadecimal_value_with_prefix_u16(&self) -> Result<u16>