pub enum Source {
    Stdin,
    Path(PathBuf),
    Url(Url),
}
Expand description

A source for data that needs to be deserialized.

Variants

Stdin

Stdin source.

Path(PathBuf)

Local file or directory source.

Url(Url)

Remote URL source.

Implementations

Returns Some if the source is a local path, None otherwise.

Returns true if the Source is a local path and the path exists on disk and is pointing at a directory.

Tries to detect the encoding of the source. Returns None if the encoding cannot be detected.

If source is a local path, this returns sources for all files matching the glob pattern.

Errors

Returns an error if the sink is not of variant Sink::Path, the pattern is invalid or if there is a io::Error while reading the file system.

Returns a SourceReader to read from the source.

Errors

May return an error if the source is Source::Path and the file cannot be opened of if source is Source::Url and there is an error requesting the remote url.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

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

This method tests for !=.

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.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

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.