#[non_exhaustive]pub enum QueryResultsFormat {
Xml,
Json,
Csv,
Tsv,
}
Expand description
SPARQL query results serialization formats.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl QueryResultsFormat
impl QueryResultsFormat
Sourcepub fn iri(self) -> &'static str
pub fn iri(self) -> &'static str
The format canonical IRI according to the Unique URIs for file formats registry.
use sparesults::QueryResultsFormat;
assert_eq!(
QueryResultsFormat::Json.iri(),
"http://www.w3.org/ns/formats/SPARQL_Results_JSON"
)
Sourcepub fn media_type(self) -> &'static str
pub fn media_type(self) -> &'static str
The format IANA media type.
use sparesults::QueryResultsFormat;
assert_eq!(
QueryResultsFormat::Json.media_type(),
"application/sparql-results+json"
)
Sourcepub fn file_extension(self) -> &'static str
pub fn file_extension(self) -> &'static str
The format IANA-registered file extension.
use sparesults::QueryResultsFormat;
assert_eq!(QueryResultsFormat::Json.file_extension(), "srj")
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The format name.
use sparesults::QueryResultsFormat;
assert_eq!(QueryResultsFormat::Json.name(), "SPARQL Results in JSON")
Sourcepub fn from_media_type(media_type: &str) -> Option<QueryResultsFormat>
pub fn from_media_type(media_type: &str) -> Option<QueryResultsFormat>
Looks for a known format from a media type.
It supports some media type aliases.
For example, “application/xml” is going to return Xml
even if it is not its canonical media type.
Example:
use sparesults::QueryResultsFormat;
assert_eq!(
QueryResultsFormat::from_media_type("application/sparql-results+json; charset=utf-8"),
Some(QueryResultsFormat::Json)
)
Sourcepub fn from_extension(extension: &str) -> Option<QueryResultsFormat>
pub fn from_extension(extension: &str) -> Option<QueryResultsFormat>
Looks for a known format from an extension.
It supports some aliases.
Example:
use sparesults::QueryResultsFormat;
assert_eq!(
QueryResultsFormat::from_extension("json"),
Some(QueryResultsFormat::Json)
)
Trait Implementations§
Source§impl Clone for QueryResultsFormat
impl Clone for QueryResultsFormat
Source§fn clone(&self) -> QueryResultsFormat
fn clone(&self) -> QueryResultsFormat
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for QueryResultsFormat
impl Debug for QueryResultsFormat
Source§impl Display for QueryResultsFormat
impl Display for QueryResultsFormat
Source§impl From<QueryResultsFormat> for QueryResultsParser
impl From<QueryResultsFormat> for QueryResultsParser
Source§fn from(format: QueryResultsFormat) -> QueryResultsParser
fn from(format: QueryResultsFormat) -> QueryResultsParser
Converts to this type from the input type.
Source§impl From<QueryResultsFormat> for QueryResultsSerializer
impl From<QueryResultsFormat> for QueryResultsSerializer
Source§fn from(format: QueryResultsFormat) -> QueryResultsSerializer
fn from(format: QueryResultsFormat) -> QueryResultsSerializer
Converts to this type from the input type.
Source§impl Hash for QueryResultsFormat
impl Hash for QueryResultsFormat
Source§impl PartialEq for QueryResultsFormat
impl PartialEq for QueryResultsFormat
impl Copy for QueryResultsFormat
impl Eq for QueryResultsFormat
impl StructuralPartialEq for QueryResultsFormat
Auto Trait Implementations§
impl Freeze for QueryResultsFormat
impl RefUnwindSafe for QueryResultsFormat
impl Send for QueryResultsFormat
impl Sync for QueryResultsFormat
impl Unpin for QueryResultsFormat
impl UnwindSafe for QueryResultsFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more