Struct Opts

Source
pub struct Opts {
Show 13 fields pub cflags: CFlag, pub iflags: IFlag, pub oflags: OFlag, pub mode: Mode, pub count: Option<usize>, pub files: Option<usize>, pub input_block_size: usize, pub input_file: Option<String>, pub input_seek: Option<usize>, pub output_block_size: usize, pub output_file: Option<String>, pub output_seek: Option<usize>, pub status: StatusLevel,
}
Expand description

conversion of strings to unsized integers & unit conversions input, output, and conversion flags Conversion flags, specified by the conv option The parsed and handled user options.

Fields§

§cflags: CFlag

convert the file as per the comma separated symbol list

§iflags: IFlag

handle the input as per the comma-separated symbol list (see [opts::IFlag])

§oflags: OFlag

handle the output as per the comma-separated symbol list (see [flags::Out])

§mode: Mode

The main mode to run in. Can be Mode::Standard, Mode::Block(usize), Mode::Unblock(usize)

§count: Option<usize>

The limit in bytes or blocks to read

§files: Option<usize>

Copy n input files before terminating. This operand is only applicable when the input device is a tape.

§input_block_size: usize

The block size of the input, in bytes. Default is 512.

§input_file: Option<String>

The input file, if any. input_file == None -> stdin

§input_seek: Option<usize>

How many input_block_sized blocks to seek on the input. If also opts::IFlag::SEEK_BYTES, seek that many bytes instead

§output_block_size: usize

The block size of the output, in bytes. Default is 512.

§output_file: Option<String>

The output file, if any. output_file == None -> stdout

§output_seek: Option<usize>

How many output_block_sized blocks to seek on the output file. Incompatible with output_file==None

§status: StatusLevel

Implementations§

Source§

impl Opts

Source

pub fn new<I>(args: I) -> Result<Self>
where I: IntoIterator<Item = String>,

Source

pub fn iflag(&self, iflag: IFlag) -> bool

iflag returns true if the specified iflag is set

let mut o = opts::Opts::default();
o.iflags = IFlag::APPEND | IFlag::SYNC;
assert!(o.iflag(IFlag::APPEND));
assert!(!o.iflag(IFlag::NOFOLLOW));
Source

pub fn oflag(&self, oflag: OFlag) -> bool

oflag returns true if the specified conversion flag is set

Source

pub fn cflag(&self, cflag: CFlag) -> bool

cflag returns true if the specified conversion flag is set

Trait Implementations§

Source§

impl Clone for Opts

Source§

fn clone(&self) -> Opts

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Opts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Opts

Source§

fn default() -> Opts

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Opts

§

impl RefUnwindSafe for Opts

§

impl Send for Opts

§

impl Sync for Opts

§

impl Unpin for Opts

§

impl UnwindSafe for Opts

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.