#[non_exhaustive]pub enum RdfFormat {
N3,
NQuads,
NTriples,
RdfXml,
TriG,
Turtle,
}
Expand description
RDF serialization formats.
This enumeration is non exhaustive. New formats like JSON-LD might be added in the future.
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 RdfFormat
impl RdfFormat
Sourcepub const fn iri(self) -> &'static str
pub const fn iri(self) -> &'static str
The format canonical IRI according to the Unique URIs for file formats registry.
use oxrdfio::RdfFormat;
assert_eq!(
RdfFormat::NTriples.iri(),
"http://www.w3.org/ns/formats/N-Triples"
)
Sourcepub const fn media_type(self) -> &'static str
pub const fn media_type(self) -> &'static str
The format IANA media type.
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::NTriples.media_type(), "application/n-triples")
Sourcepub const fn file_extension(self) -> &'static str
pub const fn file_extension(self) -> &'static str
The format IANA-registered file extension.
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::NTriples.file_extension(), "nt")
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The format name.
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::NTriples.name(), "N-Triples")
Sourcepub const fn supports_datasets(self) -> bool
pub const fn supports_datasets(self) -> bool
Checks if the formats supports RDF datasets and not only RDF graphs.
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::NTriples.supports_datasets(), false);
assert_eq!(RdfFormat::NQuads.supports_datasets(), true);
Sourcepub const fn supports_rdf_star(self) -> bool
pub const fn supports_rdf_star(self) -> bool
Checks if the formats supports RDF-star quoted triples.
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::NTriples.supports_rdf_star(), true);
assert_eq!(RdfFormat::RdfXml.supports_rdf_star(), false);
Sourcepub fn from_media_type(media_type: &str) -> Option<RdfFormat>
pub fn from_media_type(media_type: &str) -> Option<RdfFormat>
Looks for a known format from a media type.
It supports some media type aliases.
For example, “application/xml” is going to return RdfFormat::RdfXml
even if it is not its canonical media type.
Example:
use oxrdfio::RdfFormat;
assert_eq!(
RdfFormat::from_media_type("text/turtle; charset=utf-8"),
Some(RdfFormat::Turtle)
)
Sourcepub fn from_extension(extension: &str) -> Option<RdfFormat>
pub fn from_extension(extension: &str) -> Option<RdfFormat>
Looks for a known format from an extension.
It supports some aliases.
Example:
use oxrdfio::RdfFormat;
assert_eq!(RdfFormat::from_extension("nt"), Some(RdfFormat::NTriples))
Trait Implementations§
Source§impl From<DatasetFormat> for RdfFormat
impl From<DatasetFormat> for RdfFormat
Source§fn from(format: DatasetFormat) -> Self
fn from(format: DatasetFormat) -> Self
Converts to this type from the input type.
Source§impl From<GraphFormat> for RdfFormat
impl From<GraphFormat> for RdfFormat
Source§fn from(format: GraphFormat) -> Self
fn from(format: GraphFormat) -> Self
Converts to this type from the input type.
Source§impl From<RdfFormat> for RdfSerializer
impl From<RdfFormat> for RdfSerializer
Source§fn from(format: RdfFormat) -> RdfSerializer
fn from(format: RdfFormat) -> RdfSerializer
Converts to this type from the input type.
impl Copy for RdfFormat
impl Eq for RdfFormat
impl StructuralPartialEq for RdfFormat
Auto Trait Implementations§
impl Freeze for RdfFormat
impl RefUnwindSafe for RdfFormat
impl Send for RdfFormat
impl Sync for RdfFormat
impl Unpin for RdfFormat
impl UnwindSafe for RdfFormat
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