Compare commits

..

2 Commits

Author SHA1 Message Date
Nathan Fisher
efd44e16e2 Merge branch 'odin' of git.hitchhiker-linux.org:jeang3nie/version-rs into odin 2024-02-08 18:56:37 -05:00
Nathan Fisher
1aebef2c02 Make serde optional 2024-02-08 18:54:44 -05:00
4 changed files with 20 additions and 8 deletions

View File

@ -4,8 +4,10 @@ version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
serde = ["dep:serde"]
[dependencies]
chrono = { version = "0.4", features = ["serde"] }
epoch = { git = "https://git.hitchhiker-linux.org/jeang3nie/epoch-rs.git", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0", features = ["derive"], optional = true }

View File

@ -1,10 +1,13 @@
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use {
crate::error::Error,
serde::{Deserialize, Serialize},
std::{fmt, str},
};
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
/// Represents the processor architecture the software is compiled for
pub enum Arch {
Any,

View File

@ -1,11 +1,14 @@
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use {
crate::{error::Error, MAX_U12},
epoch::DateTime,
serde::{Deserialize, Serialize},
std::{cmp, convert::Into, fmt, num::NonZeroU16, str},
};
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
/// A specification for non-production releases
pub enum PreRelease {
Alpha(Option<NonZeroU16>),

View File

@ -1,10 +1,13 @@
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use {
crate::{arch::Arch, error::Error, prerelease::PreRelease, MAX_U12},
serde::{Deserialize, Serialize},
std::{cmp, fmt, str},
};
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub enum Kind {
Simple {
major: u16,
@ -26,7 +29,8 @@ pub enum Kind {
},
}
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Version {
pub kind: Kind,
pub pre: PreRelease,