pub struct OutputPath { /* private fields */ }
Expand description

A builder for Output that validates the path but defers creating it until you call the create method.

It is designed to be used with the clap crate when taking a file name as an argument to CLI app

use clap::Parser;
use clio::OutputPath;

#[derive(Parser)]
struct Opt {
    /// path to file, use '-' for stdout
    #[clap(value_parser)]
    output_file: OutputPath,
}

Implementations

Construct a new OutputPath from an string

It checks if an output file could plausibly be created at that path

Contructs a new OutputPath of "-" for stdout

Creater the file with a predetermined length, either using File::set_len or as the content-length header of the http put

Create an Output without setting the length

The original path represented by this OutputPath

Trait Implementations

Formats the value using the given formatter. Read more

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

formats as the path it was created from

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.