#[cfg(doc)]
use std::str::FromStr;
use std::{
io::{Read, stdin},
path::Path,
};
use crate::FileFormatSchema;
pub trait MetadataFile<T>
where
T: FileFormatSchema,
{
type Err;
fn from_file(file: impl AsRef<Path>) -> Result<Self, Self::Err>
where
Self: Sized,
{
Self::from_file_with_schema(file, None)
}
fn from_file_with_schema(file: impl AsRef<Path>, schema: Option<T>) -> Result<Self, Self::Err>
where
Self: Sized;
fn from_stdin() -> Result<Self, Self::Err>
where
Self: Sized,
{
Self::from_stdin_with_schema(None)
}
fn from_stdin_with_schema(schema: Option<T>) -> Result<Self, Self::Err>
where
Self: Sized,
{
Self::from_reader_with_schema(stdin(), schema)
}
fn from_reader(reader: impl Read) -> Result<Self, Self::Err>
where
Self: Sized,
{
Self::from_reader_with_schema(reader, None)
}
fn from_reader_with_schema(reader: impl Read, schema: Option<T>) -> Result<Self, Self::Err>
where
Self: Sized;
fn from_str_with_schema(s: &str, schema: Option<T>) -> Result<Self, Self::Err>
where
Self: Sized;
}