Skip to content

Commit

Permalink
refactor: cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ekkolon committed Dec 2, 2023
1 parent 5d5d4f4 commit 2be053d
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 31 deletions.
14 changes: 7 additions & 7 deletions src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error::Error,
metadata::{audio, image, video},
metadata::{Audio, Image, Video},
object_type::ObjectType,
Result,
};
Expand Down Expand Up @@ -45,27 +45,27 @@ pub struct Metadata {

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub image: Option<image::Image>,
pub image: Option<Image>,

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub video: Option<video::Video>,
pub video: Option<Video>,

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub audio: Option<audio::Audio>,
pub audio: Option<Audio>,

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub images: Vec<image::Image>,
pub images: Vec<Image>,

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub videos: Vec<video::Video>,
pub videos: Vec<Video>,

/// A brief description of the content, usually between 2 and 4 sentences.
#[serde(default)]
pub audios: Vec<audio::Audio>,
pub audios: Vec<Audio>,
}

#[derive(Serialize, Deserialize, Default, Debug, Clone)]
Expand Down
15 changes: 15 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use ogp::{
builder::Metadata,
object_type::{
article::Article,
},
};


fn main() {
let _basic = Metadata::default();

let w = Article::default();

println!("{}", serde_json::to_string_pretty(&w).unwrap())
}
8 changes: 4 additions & 4 deletions src/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use crate::object_type::ObjectType;
use serde::{Deserialize, Serialize};

use self::{audio::Audio, image::Image, video::Video};
pub use self::{audio::Audio, image::Image, video::Video};

pub mod audio;
pub mod image;
pub mod video;
mod audio;
mod image;
mod video;
5 changes: 2 additions & 3 deletions src/object_type/article.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
object_type::ObjectType,
Result,
};
use serde::{de::IntoDeserializer, Deserialize, Serialize};

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct Article {
Expand Down
6 changes: 2 additions & 4 deletions src/object_type/book.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//! Metadata utility for the Open Graph `book` meta tag.

use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
builder::{MetadataBuilder, ObjectMetadata},
object_type::ObjectType,
Result,
};
use serde::{de::IntoDeserializer, Deserialize, Serialize};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct Book {
Expand Down
4 changes: 1 addition & 3 deletions src/object_type/music.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! Metadata utility for the Open Graph `music` meta tag.

use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
builder::{MetadataBuilder, ObjectMetadata},
object_type::ObjectType,
Result,
};
Expand Down
4 changes: 1 addition & 3 deletions src/object_type/profile.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! Metadata utility for the Open Graph `profile` meta tag.

use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
builder::{MetadataBuilder, ObjectMetadata},
object_type::ObjectType,
Result,
};
Expand Down
6 changes: 2 additions & 4 deletions src/object_type/video.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//! Metadata utility for the Open Graph `music` meta tag.

use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
builder::{MetadataBuilder, ObjectMetadata},
object_type::ObjectType,
Result,
};
use serde::{de::IntoDeserializer, Deserialize, Serialize};
use serde::{Deserialize, Serialize};

// TODO: Add missing props
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
Expand Down
4 changes: 1 addition & 3 deletions src/object_type/website.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// TODO: Add docs

use crate::{
builder::{Metadata, MetadataBuilder, ObjectMetadata},
error::Error,
metadata::{audio, image, video},
builder::{MetadataBuilder, ObjectMetadata},
object_type::ObjectType,
Result,
};
Expand Down

0 comments on commit 2be053d

Please sign in to comment.