pub mod comment;
pub mod status;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Pull<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub body: std::option::Option<jacquard_common::CowStr<'a>>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub mentions: std::option::Option<Vec<jacquard_common::types::string::Did<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub patch: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub patch_blob: jacquard_common::types::blob::BlobRef<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub references: std::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub source: std::option::Option<crate::sh_tangled::repo::pull::Source<'a>>,
#[serde(borrow)]
pub target: crate::sh_tangled::repo::pull::Target<'a>,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
}
pub mod pull_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 CreatedAt;
type PatchBlob;
type Title;
type Target;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type PatchBlob = Unset;
type Title = Unset;
type Target = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type PatchBlob = S::PatchBlob;
type Title = S::Title;
type Target = S::Target;
}
pub struct SetPatchBlob<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPatchBlob<S> {}
impl<S: State> State for SetPatchBlob<S> {
type CreatedAt = S::CreatedAt;
type PatchBlob = Set<members::patch_blob>;
type Title = S::Title;
type Target = S::Target;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type CreatedAt = S::CreatedAt;
type PatchBlob = S::PatchBlob;
type Title = Set<members::title>;
type Target = S::Target;
}
pub struct SetTarget<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTarget<S> {}
impl<S: State> State for SetTarget<S> {
type CreatedAt = S::CreatedAt;
type PatchBlob = S::PatchBlob;
type Title = S::Title;
type Target = Set<members::target>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct patch_blob(());
pub struct title(());
pub struct target(());
}
}
pub struct PullBuilder<'a, S: pull_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<Vec<jacquard_common::types::string::Did<'a>>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
::core::option::Option<crate::sh_tangled::repo::pull::Source<'a>>,
::core::option::Option<crate::sh_tangled::repo::pull::Target<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Pull<'a> {
pub fn new() -> PullBuilder<'a, pull_state::Empty> {
PullBuilder::new()
}
}
impl<'a> PullBuilder<'a, pull_state::Empty> {
pub fn new() -> Self {
PullBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: pull_state::State> PullBuilder<'a, S> {
pub fn body(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_body(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> PullBuilder<'a, S>
where
S: pull_state::State,
S::CreatedAt: pull_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> PullBuilder<'a, pull_state::SetCreatedAt<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
PullBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: pull_state::State> PullBuilder<'a, S> {
pub fn mentions(
mut self,
value: impl Into<Option<Vec<jacquard_common::types::string::Did<'a>>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_mentions(
mut self,
value: Option<Vec<jacquard_common::types::string::Did<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: pull_state::State> PullBuilder<'a, S> {
pub fn patch(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_patch(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S> PullBuilder<'a, S>
where
S: pull_state::State,
S::PatchBlob: pull_state::IsUnset,
{
pub fn patch_blob(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> PullBuilder<'a, pull_state::SetPatchBlob<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
PullBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: pull_state::State> PullBuilder<'a, S> {
pub fn references(
mut self,
value: impl Into<Option<Vec<jacquard_common::types::string::AtUri<'a>>>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_references(
mut self,
value: Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: pull_state::State> PullBuilder<'a, S> {
pub fn source(
mut self,
value: impl Into<Option<crate::sh_tangled::repo::pull::Source<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_source(
mut self,
value: Option<crate::sh_tangled::repo::pull::Source<'a>>,
) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S> PullBuilder<'a, S>
where
S: pull_state::State,
S::Target: pull_state::IsUnset,
{
pub fn target(
mut self,
value: impl Into<crate::sh_tangled::repo::pull::Target<'a>>,
) -> PullBuilder<'a, pull_state::SetTarget<S>> {
self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
PullBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> PullBuilder<'a, S>
where
S: pull_state::State,
S::Title: pull_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> PullBuilder<'a, pull_state::SetTitle<S>> {
self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
PullBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> PullBuilder<'a, S>
where
S: pull_state::State,
S::CreatedAt: pull_state::IsSet,
S::PatchBlob: pull_state::IsSet,
S::Title: pull_state::IsSet,
S::Target: pull_state::IsSet,
{
pub fn build(self) -> Pull<'a> {
Pull {
body: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1.unwrap(),
mentions: self.__unsafe_private_named.2,
patch: self.__unsafe_private_named.3,
patch_blob: self.__unsafe_private_named.4.unwrap(),
references: self.__unsafe_private_named.5,
source: self.__unsafe_private_named.6,
target: self.__unsafe_private_named.7.unwrap(),
title: self.__unsafe_private_named.8.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>,
>,
) -> Pull<'a> {
Pull {
body: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1.unwrap(),
mentions: self.__unsafe_private_named.2,
patch: self.__unsafe_private_named.3,
patch_blob: self.__unsafe_private_named.4.unwrap(),
references: self.__unsafe_private_named.5,
source: self.__unsafe_private_named.6,
target: self.__unsafe_private_named.7.unwrap(),
title: self.__unsafe_private_named.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Pull<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, PullRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct PullGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Pull<'a>,
}
impl From<PullGetRecordOutput<'_>> for Pull<'_> {
fn from(output: PullGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Pull<'_> {
const NSID: &'static str = "sh.tangled.repo.pull";
type Record = PullRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct PullRecord;
impl jacquard_common::xrpc::XrpcResp for PullRecord {
const NSID: &'static str = "sh.tangled.repo.pull";
const ENCODING: &'static str = "application/json";
type Output<'de> = PullGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for PullRecord {
const NSID: &'static str = "sh.tangled.repo.pull";
type Record = PullRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Pull<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.pull"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_pull()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.patch_blob;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["text/x-patch"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobMimeTypeNotAccepted {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"patch_blob",
),
accepted: vec!["text/x-patch".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
fn lexicon_doc_sh_tangled_repo_pull() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("sh.tangled.repo.pull"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: None,
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("target"),
::jacquard_common::deps::smol_str::SmolStr::new_static("title"),
::jacquard_common::deps::smol_str::SmolStr::new_static("patchBlob"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"body",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
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(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
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.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"mentions",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Did,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"patch",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"(deprecated) use patchBlob instead",
),
),
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(
"patchBlob",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
description: None,
accept: None,
max_size: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"references",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"source",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#source"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"target",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#target"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"title",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
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("source"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("branch"),
::jacquard_common::deps::smol_str::SmolStr::new_static("sha")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"branch",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
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::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
),
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(
"sha",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: Some(40usize),
max_length: Some(40usize),
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("target"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("repo"),
::jacquard_common::deps::smol_str::SmolStr::new_static("branch")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"branch",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
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::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
),
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
},
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct Source<'a> {
#[serde(borrow)]
pub branch: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub repo: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
#[serde(borrow)]
pub sha: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Source<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.pull"
}
fn def_name() -> &'static str {
"source"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_pull()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.sha;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 40usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"sha",
),
max: 40usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.sha;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 40usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MinLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"sha",
),
min: 40usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Target<'a> {
#[serde(borrow)]
pub branch: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub repo: jacquard_common::types::string::AtUri<'a>,
}
pub mod target_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 Repo;
type Branch;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Repo = Unset;
type Branch = Unset;
}
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 Repo = Set<members::repo>;
type Branch = S::Branch;
}
pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBranch<S> {}
impl<S: State> State for SetBranch<S> {
type Repo = S::Repo;
type Branch = Set<members::branch>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct repo(());
pub struct branch(());
}
}
pub struct TargetBuilder<'a, S: target_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Target<'a> {
pub fn new() -> TargetBuilder<'a, target_state::Empty> {
TargetBuilder::new()
}
}
impl<'a> TargetBuilder<'a, target_state::Empty> {
pub fn new() -> Self {
TargetBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TargetBuilder<'a, S>
where
S: target_state::State,
S::Branch: target_state::IsUnset,
{
pub fn branch(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> TargetBuilder<'a, target_state::SetBranch<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
TargetBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TargetBuilder<'a, S>
where
S: target_state::State,
S::Repo: target_state::IsUnset,
{
pub fn repo(
mut self,
value: impl Into<jacquard_common::types::string::AtUri<'a>>,
) -> TargetBuilder<'a, target_state::SetRepo<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
TargetBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TargetBuilder<'a, S>
where
S: target_state::State,
S::Repo: target_state::IsSet,
S::Branch: target_state::IsSet,
{
pub fn build(self) -> Target<'a> {
Target {
branch: self.__unsafe_private_named.0.unwrap(),
repo: self.__unsafe_private_named.1.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>,
>,
) -> Target<'a> {
Target {
branch: self.__unsafe_private_named.0.unwrap(),
repo: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Target<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo.pull"
}
fn def_name() -> &'static str {
"target"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo_pull()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}