pub mod cursor;
pub mod diff;
pub mod draft;
pub mod get_branch;
pub mod get_contributors;
pub mod get_edit_history;
pub mod get_edit_tree;
pub mod list_drafts;
pub mod root;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::edit;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DocRef<'a> {
#[serde(borrow)]
pub value: DocRefValue<'a>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum DocRefValue<'a> {
#[serde(rename = "sh.weaver.edit.defs#notebookRef")]
NotebookRef(Box<edit::NotebookRef<'a>>),
#[serde(rename = "sh.weaver.edit.defs#entryRef")]
EntryRef(Box<edit::EntryRef<'a>>),
#[serde(rename = "sh.weaver.edit.defs#draftRef")]
DraftRef(Box<edit::DraftRef<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct DraftRef<'a> {
#[serde(borrow)]
pub draft_key: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EditBranchView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub diverges_from: Option<StrongRef<'a>>,
#[serde(borrow)]
pub head: StrongRef<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_merged: Option<bool>,
pub last_updated: Datetime,
pub length: i64,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub root: Option<StrongRef<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EditHistoryEntry<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_inline_diff: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub prev_ref: Option<StrongRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub root_ref: Option<StrongRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub snapshot_cid: Option<Cid<'a>>,
#[serde(borrow)]
pub r#type: EditHistoryEntryType<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EditHistoryEntryType<'a> {
Root,
Diff,
Other(CowStr<'a>),
}
impl<'a> EditHistoryEntryType<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Root => "root",
Self::Diff => "diff",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for EditHistoryEntryType<'a> {
fn from(s: &'a str) -> Self {
match s {
"root" => Self::Root,
"diff" => Self::Diff,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for EditHistoryEntryType<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"root" => Self::Root,
"diff" => Self::Diff,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for EditHistoryEntryType<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for EditHistoryEntryType<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for EditHistoryEntryType<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for EditHistoryEntryType<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for EditHistoryEntryType<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for EditHistoryEntryType<'_> {
type Output = EditHistoryEntryType<'static>;
fn into_static(self) -> Self::Output {
match self {
EditHistoryEntryType::Root => EditHistoryEntryType::Root,
EditHistoryEntryType::Diff => EditHistoryEntryType::Diff,
EditHistoryEntryType::Other(v) => {
EditHistoryEntryType::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EditTreeView<'a> {
#[serde(borrow)]
pub branches: Vec<edit::EditBranchView<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub conflict_points: Option<Vec<StrongRef<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_conflicts: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub main_branch: Option<edit::EditBranchView<'a>>,
#[serde(borrow)]
pub resource: StrongRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EntryRef<'a> {
#[serde(borrow)]
pub entry: StrongRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotebookRef<'a> {
#[serde(borrow)]
pub notebook: StrongRef<'a>,
}
impl<'a> LexiconSchema for DocRef<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"docRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for DraftRef<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"draftRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.draft_key;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 200usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("draft_key"),
max: 200usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for EditBranchView<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"editBranchView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for EditHistoryEntry<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"editHistoryEntry"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for EditTreeView<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"editTreeView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for EntryRef<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"entryRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for NotebookRef<'a> {
fn nsid() -> &'static str {
"sh.weaver.edit.defs"
}
fn def_name() -> &'static str {
"notebookRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_edit_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod doc_ref_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 Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Value = Unset;
}
pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValue<S> {}
impl<S: State> State for SetValue<S> {
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct value(());
}
}
pub struct DocRefBuilder<'a, S: doc_ref_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<DocRefValue<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DocRef<'a> {
pub fn new() -> DocRefBuilder<'a, doc_ref_state::Empty> {
DocRefBuilder::new()
}
}
impl<'a> DocRefBuilder<'a, doc_ref_state::Empty> {
pub fn new() -> Self {
DocRefBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DocRefBuilder<'a, S>
where
S: doc_ref_state::State,
S::Value: doc_ref_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<DocRefValue<'a>>,
) -> DocRefBuilder<'a, doc_ref_state::SetValue<S>> {
self._fields.0 = Option::Some(value.into());
DocRefBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DocRefBuilder<'a, S>
where
S: doc_ref_state::State,
S::Value: doc_ref_state::IsSet,
{
pub fn build(self) -> DocRef<'a> {
DocRef {
value: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DocRef<'a> {
DocRef {
value: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_edit_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("sh.weaver.edit.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("docRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("value")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#notebookRef"),
CowStr::new_static("#entryRef"),
CowStr::new_static("#draftRef")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("draftKey")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("draftKey"),
LexObjectProperty::String(LexString {
max_length: Some(200usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("editBranchView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A branch/fork in edit history (for when collaborators diverge).",
),
),
required: Some(
vec![
SmolStr::new_static("head"), SmolStr::new_static("author"),
SmolStr::new_static("length"),
SmolStr::new_static("lastUpdated")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("divergesFrom"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("head"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isMerged"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastUpdated"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("length"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("root"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("editHistoryEntry"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Summary of an edit (root or diff) for history queries.",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"),
SmolStr::new_static("createdAt"), SmolStr::new_static("type")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hasInlineDiff"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prevRef"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("rootRef"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("snapshotCid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("editTreeView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Full tree structure showing all branches for a resource.",
),
),
required: Some(
vec![
SmolStr::new_static("resource"),
SmolStr::new_static("branches")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("branches"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#editBranchView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("conflictPoints"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Diffs where branches diverge"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hasConflicts"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mainBranch"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#editBranchView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("resource"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("entry")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("notebook")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("notebook"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod edit_branch_view_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 Length;
type Author;
type LastUpdated;
type Head;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Length = Unset;
type Author = Unset;
type LastUpdated = Unset;
type Head = Unset;
}
pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLength<S> {}
impl<S: State> State for SetLength<S> {
type Length = Set<members::length>;
type Author = S::Author;
type LastUpdated = S::LastUpdated;
type Head = S::Head;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Length = S::Length;
type Author = Set<members::author>;
type LastUpdated = S::LastUpdated;
type Head = S::Head;
}
pub struct SetLastUpdated<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLastUpdated<S> {}
impl<S: State> State for SetLastUpdated<S> {
type Length = S::Length;
type Author = S::Author;
type LastUpdated = Set<members::last_updated>;
type Head = S::Head;
}
pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHead<S> {}
impl<S: State> State for SetHead<S> {
type Length = S::Length;
type Author = S::Author;
type LastUpdated = S::LastUpdated;
type Head = Set<members::head>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct length(());
pub struct author(());
pub struct last_updated(());
pub struct head(());
}
}
pub struct EditBranchViewBuilder<'a, S: edit_branch_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<StrongRef<'a>>,
Option<StrongRef<'a>>,
Option<bool>,
Option<Datetime>,
Option<i64>,
Option<StrongRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> EditBranchView<'a> {
pub fn new() -> EditBranchViewBuilder<'a, edit_branch_view_state::Empty> {
EditBranchViewBuilder::new()
}
}
impl<'a> EditBranchViewBuilder<'a, edit_branch_view_state::Empty> {
pub fn new() -> Self {
EditBranchViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditBranchViewBuilder<'a, S>
where
S: edit_branch_view_state::State,
S::Author: edit_branch_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
EditBranchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
pub fn diverges_from(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_diverges_from(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> EditBranchViewBuilder<'a, S>
where
S: edit_branch_view_state::State,
S::Head: edit_branch_view_state::IsUnset,
{
pub fn head(
mut self,
value: impl Into<StrongRef<'a>>,
) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetHead<S>> {
self._fields.2 = Option::Some(value.into());
EditBranchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
pub fn is_merged(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_is_merged(mut self, value: Option<bool>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> EditBranchViewBuilder<'a, S>
where
S: edit_branch_view_state::State,
S::LastUpdated: edit_branch_view_state::IsUnset,
{
pub fn last_updated(
mut self,
value: impl Into<Datetime>,
) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetLastUpdated<S>> {
self._fields.4 = Option::Some(value.into());
EditBranchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditBranchViewBuilder<'a, S>
where
S: edit_branch_view_state::State,
S::Length: edit_branch_view_state::IsUnset,
{
pub fn length(
mut self,
value: impl Into<i64>,
) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetLength<S>> {
self._fields.5 = Option::Some(value.into());
EditBranchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
pub fn root(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_root(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> EditBranchViewBuilder<'a, S>
where
S: edit_branch_view_state::State,
S::Length: edit_branch_view_state::IsSet,
S::Author: edit_branch_view_state::IsSet,
S::LastUpdated: edit_branch_view_state::IsSet,
S::Head: edit_branch_view_state::IsSet,
{
pub fn build(self) -> EditBranchView<'a> {
EditBranchView {
author: self._fields.0.unwrap(),
diverges_from: self._fields.1,
head: self._fields.2.unwrap(),
is_merged: self._fields.3,
last_updated: self._fields.4.unwrap(),
length: self._fields.5.unwrap(),
root: self._fields.6,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> EditBranchView<'a> {
EditBranchView {
author: self._fields.0.unwrap(),
diverges_from: self._fields.1,
head: self._fields.2.unwrap(),
is_merged: self._fields.3,
last_updated: self._fields.4.unwrap(),
length: self._fields.5.unwrap(),
root: self._fields.6,
extra_data: Some(extra_data),
}
}
}
pub mod edit_history_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 Cid;
type Uri;
type CreatedAt;
type Type;
type Author;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type Uri = Unset;
type CreatedAt = Unset;
type Type = Unset;
type Author = Unset;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Cid = Set<members::cid>;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
type Type = S::Type;
type Author = S::Author;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Cid = S::Cid;
type Uri = Set<members::uri>;
type CreatedAt = S::CreatedAt;
type Type = S::Type;
type Author = S::Author;
}
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 Cid = S::Cid;
type Uri = S::Uri;
type CreatedAt = Set<members::created_at>;
type Type = S::Type;
type Author = S::Author;
}
pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Cid = S::Cid;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
type Type = Set<members::r#type>;
type Author = S::Author;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Cid = S::Cid;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
type Type = S::Type;
type Author = Set<members::author>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct uri(());
pub struct created_at(());
pub struct r#type(());
pub struct author(());
}
}
pub struct EditHistoryEntryBuilder<'a, S: edit_history_entry_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<bool>,
Option<StrongRef<'a>>,
Option<StrongRef<'a>>,
Option<Cid<'a>>,
Option<EditHistoryEntryType<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> EditHistoryEntry<'a> {
pub fn new() -> EditHistoryEntryBuilder<'a, edit_history_entry_state::Empty> {
EditHistoryEntryBuilder::new()
}
}
impl<'a> EditHistoryEntryBuilder<'a, edit_history_entry_state::Empty> {
pub fn new() -> Self {
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::Author: edit_history_entry_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::Cid: edit_history_entry_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::CreatedAt: edit_history_entry_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetCreatedAt<S>> {
self._fields.2 = Option::Some(value.into());
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
pub fn has_inline_diff(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_has_inline_diff(mut self, value: Option<bool>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
pub fn prev_ref(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_prev_ref(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
pub fn root_ref(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_root_ref(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
pub fn snapshot_cid(mut self, value: impl Into<Option<Cid<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_snapshot_cid(mut self, value: Option<Cid<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::Type: edit_history_entry_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<EditHistoryEntryType<'a>>,
) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetType<S>> {
self._fields.7 = Option::Some(value.into());
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::Uri: edit_history_entry_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetUri<S>> {
self._fields.8 = Option::Some(value.into());
EditHistoryEntryBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditHistoryEntryBuilder<'a, S>
where
S: edit_history_entry_state::State,
S::Cid: edit_history_entry_state::IsSet,
S::Uri: edit_history_entry_state::IsSet,
S::CreatedAt: edit_history_entry_state::IsSet,
S::Type: edit_history_entry_state::IsSet,
S::Author: edit_history_entry_state::IsSet,
{
pub fn build(self) -> EditHistoryEntry<'a> {
EditHistoryEntry {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
has_inline_diff: self._fields.3,
prev_ref: self._fields.4,
root_ref: self._fields.5,
snapshot_cid: self._fields.6,
r#type: self._fields.7.unwrap(),
uri: self._fields.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> EditHistoryEntry<'a> {
EditHistoryEntry {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
has_inline_diff: self._fields.3,
prev_ref: self._fields.4,
root_ref: self._fields.5,
snapshot_cid: self._fields.6,
r#type: self._fields.7.unwrap(),
uri: self._fields.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod edit_tree_view_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 Resource;
type Branches;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Resource = Unset;
type Branches = Unset;
}
pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetResource<S> {}
impl<S: State> State for SetResource<S> {
type Resource = Set<members::resource>;
type Branches = S::Branches;
}
pub struct SetBranches<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBranches<S> {}
impl<S: State> State for SetBranches<S> {
type Resource = S::Resource;
type Branches = Set<members::branches>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct resource(());
pub struct branches(());
}
}
pub struct EditTreeViewBuilder<'a, S: edit_tree_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<edit::EditBranchView<'a>>>,
Option<Vec<StrongRef<'a>>>,
Option<bool>,
Option<edit::EditBranchView<'a>>,
Option<StrongRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> EditTreeView<'a> {
pub fn new() -> EditTreeViewBuilder<'a, edit_tree_view_state::Empty> {
EditTreeViewBuilder::new()
}
}
impl<'a> EditTreeViewBuilder<'a, edit_tree_view_state::Empty> {
pub fn new() -> Self {
EditTreeViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditTreeViewBuilder<'a, S>
where
S: edit_tree_view_state::State,
S::Branches: edit_tree_view_state::IsUnset,
{
pub fn branches(
mut self,
value: impl Into<Vec<edit::EditBranchView<'a>>>,
) -> EditTreeViewBuilder<'a, edit_tree_view_state::SetBranches<S>> {
self._fields.0 = Option::Some(value.into());
EditTreeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
pub fn conflict_points(
mut self,
value: impl Into<Option<Vec<StrongRef<'a>>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_conflict_points(mut self, value: Option<Vec<StrongRef<'a>>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
pub fn has_conflicts(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_has_conflicts(mut self, value: Option<bool>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
pub fn main_branch(
mut self,
value: impl Into<Option<edit::EditBranchView<'a>>>,
) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_main_branch(mut self, value: Option<edit::EditBranchView<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> EditTreeViewBuilder<'a, S>
where
S: edit_tree_view_state::State,
S::Resource: edit_tree_view_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<StrongRef<'a>>,
) -> EditTreeViewBuilder<'a, edit_tree_view_state::SetResource<S>> {
self._fields.4 = Option::Some(value.into());
EditTreeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EditTreeViewBuilder<'a, S>
where
S: edit_tree_view_state::State,
S::Resource: edit_tree_view_state::IsSet,
S::Branches: edit_tree_view_state::IsSet,
{
pub fn build(self) -> EditTreeView<'a> {
EditTreeView {
branches: self._fields.0.unwrap(),
conflict_points: self._fields.1,
has_conflicts: self._fields.2,
main_branch: self._fields.3,
resource: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> EditTreeView<'a> {
EditTreeView {
branches: self._fields.0.unwrap(),
conflict_points: self._fields.1,
has_conflicts: self._fields.2,
main_branch: self._fields.3,
resource: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod entry_ref_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 Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entry = Unset;
}
pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetEntry<S> {}
impl<S: State> State for SetEntry<S> {
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entry(());
}
}
pub struct EntryRefBuilder<'a, S: entry_ref_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<StrongRef<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> EntryRef<'a> {
pub fn new() -> EntryRefBuilder<'a, entry_ref_state::Empty> {
EntryRefBuilder::new()
}
}
impl<'a> EntryRefBuilder<'a, entry_ref_state::Empty> {
pub fn new() -> Self {
EntryRefBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EntryRefBuilder<'a, S>
where
S: entry_ref_state::State,
S::Entry: entry_ref_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<StrongRef<'a>>,
) -> EntryRefBuilder<'a, entry_ref_state::SetEntry<S>> {
self._fields.0 = Option::Some(value.into());
EntryRefBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EntryRefBuilder<'a, S>
where
S: entry_ref_state::State,
S::Entry: entry_ref_state::IsSet,
{
pub fn build(self) -> EntryRef<'a> {
EntryRef {
entry: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> EntryRef<'a> {
EntryRef {
entry: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod notebook_ref_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 Notebook;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Notebook = Unset;
}
pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetNotebook<S> {}
impl<S: State> State for SetNotebook<S> {
type Notebook = Set<members::notebook>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct notebook(());
}
}
pub struct NotebookRefBuilder<'a, S: notebook_ref_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<StrongRef<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> NotebookRef<'a> {
pub fn new() -> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
NotebookRefBuilder::new()
}
}
impl<'a> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
pub fn new() -> Self {
NotebookRefBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotebookRefBuilder<'a, S>
where
S: notebook_ref_state::State,
S::Notebook: notebook_ref_state::IsUnset,
{
pub fn notebook(
mut self,
value: impl Into<StrongRef<'a>>,
) -> NotebookRefBuilder<'a, notebook_ref_state::SetNotebook<S>> {
self._fields.0 = Option::Some(value.into());
NotebookRefBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotebookRefBuilder<'a, S>
where
S: notebook_ref_state::State,
S::Notebook: notebook_ref_state::IsSet,
{
pub fn build(self) -> NotebookRef<'a> {
NotebookRef {
notebook: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> NotebookRef<'a> {
NotebookRef {
notebook: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}