summaryrefslogtreecommitdiffstats
path: root/core/src/resource/source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/resource/source.rs')
-rw-r--r--core/src/resource/source.rs25
1 files changed, 9 insertions, 16 deletions
diff --git a/core/src/resource/source.rs b/core/src/resource/source.rs
index 2184871..11603eb 100644
--- a/core/src/resource/source.rs
+++ b/core/src/resource/source.rs
@@ -1,21 +1,15 @@
+use headers::header_components::MediaType;
+use iri::IRI;
-use headers::{
- header_components::MediaType
-};
-use ::{
- iri::IRI
-};
-
-#[cfg(feature="serde")]
-use serde::{Serialize, Deserialize};
+#[cfg(feature = "serde")]
+use serde::{Deserialize, Serialize};
/// POD containing the IRI which should be used to laod a resource well as
/// an optional file name to use and a description about how the content type
/// should be handled.
#[derive(Debug, Clone)]
-#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Source {
-
/// A International Resource Identifier pointing to a source
/// from which the Resource can be loaded. Note that the interpretation
/// of the IRI is left to the `ResourceLoader` implementation of the
@@ -24,7 +18,7 @@ pub struct Source {
pub iri: IRI,
/// Allows specifying how the media type detection is done.
- #[cfg_attr(feature="serde", serde(default))]
+ #[cfg_attr(feature = "serde", serde(default))]
pub use_media_type: UseMediaType,
/// Allows providing a explicit name overriding any inferred name.
@@ -38,8 +32,8 @@ pub struct Source {
/// Note that file names are optional and don't need to be provided at all.
/// But it is strongly recommended to provide them for anything used as
/// attachment but normally irrelevant for anything else.
- #[cfg_attr(feature="serde", serde(default))]
- pub use_file_name: Option<String>
+ #[cfg_attr(feature = "serde", serde(default))]
+ pub use_file_name: Option<String>,
}
/// Specifies how the content type should be handled when loading the data.
@@ -50,7 +44,7 @@ pub struct Source {
/// depends on the context implementation.
///
#[derive(Debug, Clone)]
-#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum UseMediaType {
/// Sniff content type if no content type was given from any other place.
Auto,
@@ -61,7 +55,6 @@ pub enum UseMediaType {
/// this place could be storing the data with the right content type, in which
/// case that content type should be used.
Default(MediaType),
-
// /// Always use this content type even if it is known to have a different content type.
// Override(MediaType)
}