#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct LastCommit<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub author: std::option::Option<crate::sh_tangled::repo::tree::Signature<'a>>,
#[serde(borrow)]
pub hash: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub message: jacquard_common::CowStr<'a>,
pub when: jacquard_common::types::string::Datetime,
}
pub mod last_commit_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type When;
type Hash;
type Message;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type When = Unset;
type Hash = Unset;
type Message = Unset;
}
pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetWhen<S> {}
impl<S: State> State for SetWhen<S> {
type When = Set<members::when>;
type Hash = S::Hash;
type Message = S::Message;
}
pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHash<S> {}
impl<S: State> State for SetHash<S> {
type When = S::When;
type Hash = Set<members::hash>;
type Message = S::Message;
}
pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMessage<S> {}
impl<S: State> State for SetMessage<S> {
type When = S::When;
type Hash = S::Hash;
type Message = Set<members::message>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct when(());
pub struct hash(());
pub struct message(());
}
}
pub struct LastCommitBuilder<'a, S: last_commit_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::sh_tangled::repo::tree::Signature<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> LastCommit<'a> {
pub fn new() -> LastCommitBuilder<'a, last_commit_state::Empty> {
LastCommitBuilder::new()
}
}
impl<'a> LastCommitBuilder<'a, last_commit_state::Empty> {
pub fn new() -> Self {
LastCommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: last_commit_state::State> LastCommitBuilder<'a, S> {
pub fn author(
mut self,
value: impl Into<Option<crate::sh_tangled::repo::tree::Signature<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_author(
mut self,
value: Option<crate::sh_tangled::repo::tree::Signature<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> LastCommitBuilder<'a, S>
where
S: last_commit_state::State,
S::Hash: last_commit_state::IsUnset,
{
pub fn hash(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> LastCommitBuilder<'a, last_commit_state::SetHash<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
LastCommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> LastCommitBuilder<'a, S>
where
S: last_commit_state::State,
S::Message: last_commit_state::IsUnset,
{
pub fn message(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> LastCommitBuilder<'a, last_commit_state::SetMessage<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
LastCommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> LastCommitBuilder<'a, S>
where
S: last_commit_state::State,
S::When: last_commit_state::IsUnset,
{
pub fn when(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> LastCommitBuilder<'a, last_commit_state::SetWhen<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
LastCommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> LastCommitBuilder<'a, S>
where
S: last_commit_state::State,
S::When: last_commit_state::IsSet,
S::Hash: last_commit_state::IsSet,
S::Message: last_commit_state::IsSet,
{
pub fn build(self) -> LastCommit<'a> {
LastCommit {
author: self.__unsafe_private_named.0,
hash: self.__unsafe_private_named.1.unwrap(),
message: self.__unsafe_private_named.2.unwrap(),
when: self.__unsafe_private_named.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> LastCommit<'a> {
LastCommit {
author: self.__unsafe_private_named.0,
hash: self.__unsafe_private_named.1.unwrap(),
message: self.__unsafe_private_named.2.unwrap(),
when: self.__unsafe_private_named.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_tangled_repo_tree() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("sh.tangled.repo.tree"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("lastCommit"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("hash"),
::jacquard_common::deps::smol_str::SmolStr::new_static("message"),
::jacquard_common::deps::smol_str::SmolStr::new_static("when")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"author",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#signature"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"hash",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Commit hash"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"message",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Commit message"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"when",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Commit timestamp"),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
description: None,
parameters: Some(
::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("repo"),
::jacquard_common::deps::smol_str::SmolStr::new_static("ref")
],
),
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"path",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Path within the repository tree",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"ref",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Git reference (branch, tag, or commit SHA)",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"repo",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Repository identifier in format 'did:plc:.../repoName'",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
),
output: None,
errors: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("readme"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("filename"),
::jacquard_common::deps::smol_str::SmolStr::new_static("contents")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"contents",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Contents of the readme file",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"filename",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Name of the readme file",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("signature"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("email"),
::jacquard_common::deps::smol_str::SmolStr::new_static("when")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"email",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Author email"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Author name"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"when",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Author timestamp"),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("treeEntry"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("mode"),
::jacquard_common::deps::smol_str::SmolStr::new_static("size")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"last_commit",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#lastCommit"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"mode",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("File mode"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Relative file or directory name",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"size",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LastCommit<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.tree"
}
fn def_name() -> &'static str {
"lastCommit"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_tree()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
fn _default_path() -> std::option::Option<jacquard_common::CowStr<'static>> {
Some(jacquard_common::CowStr::from(""))
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Tree<'a> {
#[serde(default = "_default_path")]
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub path: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub r#ref: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub repo: jacquard_common::CowStr<'a>,
}
pub mod tree_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Ref;
type Repo;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Ref = Unset;
type Repo = Unset;
}
pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRef<S> {}
impl<S: State> State for SetRef<S> {
type Ref = Set<members::r#ref>;
type Repo = S::Repo;
}
pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRepo<S> {}
impl<S: State> State for SetRepo<S> {
type Ref = S::Ref;
type Repo = Set<members::repo>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct r#ref(());
pub struct repo(());
}
}
pub struct TreeBuilder<'a, S: tree_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Tree<'a> {
pub fn new() -> TreeBuilder<'a, tree_state::Empty> {
TreeBuilder::new()
}
}
impl<'a> TreeBuilder<'a, tree_state::Empty> {
pub fn new() -> Self {
TreeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: tree_state::State> TreeBuilder<'a, S> {
pub fn path(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> TreeBuilder<'a, S>
where
S: tree_state::State,
S::Ref: tree_state::IsUnset,
{
pub fn r#ref(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> TreeBuilder<'a, tree_state::SetRef<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
TreeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TreeBuilder<'a, S>
where
S: tree_state::State,
S::Repo: tree_state::IsUnset,
{
pub fn repo(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> TreeBuilder<'a, tree_state::SetRepo<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
TreeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TreeBuilder<'a, S>
where
S: tree_state::State,
S::Ref: tree_state::IsSet,
S::Repo: tree_state::IsSet,
{
pub fn build(self) -> Tree<'a> {
Tree {
path: self.__unsafe_private_named.0,
r#ref: self.__unsafe_private_named.1.unwrap(),
repo: self.__unsafe_private_named.2.unwrap(),
}
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct TreeOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub dotdot: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub files: Vec<crate::sh_tangled::repo::tree::TreeEntry<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub last_commit: std::option::Option<crate::sh_tangled::repo::tree::LastCommit<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub parent: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub readme: std::option::Option<crate::sh_tangled::repo::tree::Readme<'a>>,
#[serde(borrow)]
pub r#ref: jacquard_common::CowStr<'a>,
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
thiserror::Error,
miette::Diagnostic,
jacquard_derive::IntoStatic
)]
#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum TreeError<'a> {
#[serde(rename = "RepoNotFound")]
RepoNotFound(std::option::Option<jacquard_common::CowStr<'a>>),
#[serde(rename = "RefNotFound")]
RefNotFound(std::option::Option<jacquard_common::CowStr<'a>>),
#[serde(rename = "PathNotFound")]
PathNotFound(std::option::Option<jacquard_common::CowStr<'a>>),
#[serde(rename = "InvalidRequest")]
InvalidRequest(std::option::Option<jacquard_common::CowStr<'a>>),
}
impl core::fmt::Display for TreeError<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::RepoNotFound(msg) => {
write!(f, "RepoNotFound")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::RefNotFound(msg) => {
write!(f, "RefNotFound")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::PathNotFound(msg) => {
write!(f, "PathNotFound")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::InvalidRequest(msg) => {
write!(f, "InvalidRequest")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
}
}
}
pub struct TreeResponse;
impl jacquard_common::xrpc::XrpcResp for TreeResponse {
const NSID: &'static str = "sh.tangled.repo.tree";
const ENCODING: &'static str = "application/json";
type Output<'de> = TreeOutput<'de>;
type Err<'de> = TreeError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for Tree<'a> {
const NSID: &'static str = "sh.tangled.repo.tree";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = TreeResponse;
}
pub struct TreeRequest;
impl jacquard_common::xrpc::XrpcEndpoint for TreeRequest {
const PATH: &'static str = "/xrpc/sh.tangled.repo.tree";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = Tree<'de>;
type Response = TreeResponse;
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct Readme<'a> {
#[serde(borrow)]
pub contents: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub filename: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Readme<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.tree"
}
fn def_name() -> &'static str {
"readme"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_tree()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Signature<'a> {
#[serde(borrow)]
pub email: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
pub when: jacquard_common::types::string::Datetime,
}
pub mod signature_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Name;
type Email;
type When;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Email = Unset;
type When = Unset;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Name = Set<members::name>;
type Email = S::Email;
type When = S::When;
}
pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetEmail<S> {}
impl<S: State> State for SetEmail<S> {
type Name = S::Name;
type Email = Set<members::email>;
type When = S::When;
}
pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetWhen<S> {}
impl<S: State> State for SetWhen<S> {
type Name = S::Name;
type Email = S::Email;
type When = Set<members::when>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct email(());
pub struct when(());
}
}
pub struct SignatureBuilder<'a, S: signature_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Signature<'a> {
pub fn new() -> SignatureBuilder<'a, signature_state::Empty> {
SignatureBuilder::new()
}
}
impl<'a> SignatureBuilder<'a, signature_state::Empty> {
pub fn new() -> Self {
SignatureBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SignatureBuilder<'a, S>
where
S: signature_state::State,
S::Email: signature_state::IsUnset,
{
pub fn email(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> SignatureBuilder<'a, signature_state::SetEmail<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
SignatureBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SignatureBuilder<'a, S>
where
S: signature_state::State,
S::Name: signature_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> SignatureBuilder<'a, signature_state::SetName<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
SignatureBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SignatureBuilder<'a, S>
where
S: signature_state::State,
S::When: signature_state::IsUnset,
{
pub fn when(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> SignatureBuilder<'a, signature_state::SetWhen<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
SignatureBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SignatureBuilder<'a, S>
where
S: signature_state::State,
S::Name: signature_state::IsSet,
S::Email: signature_state::IsSet,
S::When: signature_state::IsSet,
{
pub fn build(self) -> Signature<'a> {
Signature {
email: self.__unsafe_private_named.0.unwrap(),
name: self.__unsafe_private_named.1.unwrap(),
when: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Signature<'a> {
Signature {
email: self.__unsafe_private_named.0.unwrap(),
name: self.__unsafe_private_named.1.unwrap(),
when: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Signature<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.tree"
}
fn def_name() -> &'static str {
"signature"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_tree()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct TreeEntry<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub last_commit: std::option::Option<crate::sh_tangled::repo::tree::LastCommit<'a>>,
#[serde(borrow)]
pub mode: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
pub size: i64,
}
pub mod tree_entry_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Mode;
type Size;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Mode = Unset;
type Size = Unset;
type Name = Unset;
}
pub struct SetMode<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMode<S> {}
impl<S: State> State for SetMode<S> {
type Mode = Set<members::mode>;
type Size = S::Size;
type Name = S::Name;
}
pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSize<S> {}
impl<S: State> State for SetSize<S> {
type Mode = S::Mode;
type Size = Set<members::size>;
type Name = S::Name;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Mode = S::Mode;
type Size = S::Size;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct mode(());
pub struct size(());
pub struct name(());
}
}
pub struct TreeEntryBuilder<'a, S: tree_entry_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::sh_tangled::repo::tree::LastCommit<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> TreeEntry<'a> {
pub fn new() -> TreeEntryBuilder<'a, tree_entry_state::Empty> {
TreeEntryBuilder::new()
}
}
impl<'a> TreeEntryBuilder<'a, tree_entry_state::Empty> {
pub fn new() -> Self {
TreeEntryBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: tree_entry_state::State> TreeEntryBuilder<'a, S> {
pub fn last_commit(
mut self,
value: impl Into<Option<crate::sh_tangled::repo::tree::LastCommit<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_last_commit(
mut self,
value: Option<crate::sh_tangled::repo::tree::LastCommit<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> TreeEntryBuilder<'a, S>
where
S: tree_entry_state::State,
S::Mode: tree_entry_state::IsUnset,
{
pub fn mode(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> TreeEntryBuilder<'a, tree_entry_state::SetMode<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
TreeEntryBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TreeEntryBuilder<'a, S>
where
S: tree_entry_state::State,
S::Name: tree_entry_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> TreeEntryBuilder<'a, tree_entry_state::SetName<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
TreeEntryBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TreeEntryBuilder<'a, S>
where
S: tree_entry_state::State,
S::Size: tree_entry_state::IsUnset,
{
pub fn size(
mut self,
value: impl Into<i64>,
) -> TreeEntryBuilder<'a, tree_entry_state::SetSize<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
TreeEntryBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TreeEntryBuilder<'a, S>
where
S: tree_entry_state::State,
S::Mode: tree_entry_state::IsSet,
S::Size: tree_entry_state::IsSet,
S::Name: tree_entry_state::IsSet,
{
pub fn build(self) -> TreeEntry<'a> {
TreeEntry {
last_commit: self.__unsafe_private_named.0,
mode: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
size: self.__unsafe_private_named.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> TreeEntry<'a> {
TreeEntry {
last_commit: self.__unsafe_private_named.0,
mode: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
size: self.__unsafe_private_named.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TreeEntry<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.tree"
}
fn def_name() -> &'static str {
"treeEntry"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_tree()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}