Created the revision stub.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
parent
57ee7dd6ae
commit
7f7e10a373
@ -12,6 +12,7 @@ pub enum Field {
|
||||
Duration(Duration),
|
||||
Integer(i128),
|
||||
None,
|
||||
Revision(Revision),
|
||||
StaticString(String),
|
||||
Uuid(Uuid),
|
||||
}
|
||||
@ -116,6 +117,12 @@ impl From<Duration> for Field {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Revision> for Field {
|
||||
fn from(value: Revision) -> Self {
|
||||
Self::Revision(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Field {
|
||||
fn from(value: String) -> Self {
|
||||
Self::StaticString(value)
|
||||
@ -350,6 +357,7 @@ pub enum FieldType {
|
||||
Duration,
|
||||
Integer,
|
||||
None,
|
||||
Revision,
|
||||
StaticString,
|
||||
Uuid,
|
||||
}
|
||||
@ -362,6 +370,7 @@ impl FieldType {
|
||||
FieldType::Duration => Duration::from_secs(0).into(),
|
||||
FieldType::Integer => 0.into(),
|
||||
FieldType::None => Field::None,
|
||||
FieldType::Revision => Revision::new().into(),
|
||||
FieldType::StaticString => "".into(),
|
||||
FieldType::Uuid => Uuid::new_v4().into(),
|
||||
}
|
||||
@ -376,6 +385,7 @@ impl From<&Field> for FieldType {
|
||||
Field::Duration(_) => Self::Duration,
|
||||
Field::Integer(_) => Self::Integer,
|
||||
Field::None => Self::None,
|
||||
Field::Revision(_) => Self::Revision,
|
||||
Field::StaticString(_) => Self::StaticString,
|
||||
Field::Uuid(_) => Self::Uuid,
|
||||
}
|
||||
@ -417,3 +427,22 @@ mod fieldtypes {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
struct Revision;
|
||||
|
||||
impl Revision {
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod revisions {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn can_create_empty_revision() {
|
||||
let rev = Revision::new();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user