pub mod authors;
pub mod book;
pub mod chapter;
pub mod colour_scheme;
pub mod entry;
pub mod get_book_entry;
pub mod get_chapter;
pub mod get_continue_reading;
pub mod get_entry;
pub mod get_entry_by_title;
pub mod get_entry_detail;
pub mod get_entry_feed;
pub mod get_entry_notebooks;
pub mod get_notebook;
pub mod get_notebook_by_title;
pub mod get_notebook_chapters;
pub mod get_notebook_detail;
pub mod get_notebook_feed;
pub mod get_page;
pub mod get_published_versions;
pub mod get_reading_history;
pub mod get_similar_notebooks;
pub mod get_suggested_notebooks;
pub mod page;
pub mod resolve_entry;
pub mod resolve_notebook;
pub mod resolve_version_conflict;
pub mod search_entries;
pub mod search_notebooks;
pub mod theme;
pub mod update_reading_progress;
#[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::blob::BlobRef;
use jacquard_common::types::string::{Did, AtUri, Cid, Datetime};
use jacquard_common::types::value::Data;
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::ProfileDataView;
use crate::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::notebook;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct AuthorListView<'a> {
pub index: i64,
#[serde(borrow)]
pub record: ProfileDataView<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub uri: Option<AtUri<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct BookEntryRef<'a> {
#[serde(borrow)]
pub entry: notebook::EntryView<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct BookEntryView<'a> {
#[serde(borrow)]
pub entry: notebook::EntryView<'a>,
pub index: i64,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub next: Option<notebook::BookEntryRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub prev: Option<notebook::BookEntryRef<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ChapterEntryView<'a> {
#[serde(borrow)]
pub entry: notebook::EntryView<'a>,
pub index: i64,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub next: Option<notebook::BookEntryRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub prev: Option<notebook::BookEntryRef<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ChapterView<'a> {
#[serde(borrow)]
pub authors: Vec<notebook::AuthorListView<'a>>,
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
#[serde(borrow)]
pub notebook: notebook::NotebookView<'a>,
#[serde(borrow)]
pub record: Data<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<notebook::Tags<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub title: Option<notebook::Title<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ContentFormat<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_content_format_markdown")]
#[serde(borrow)]
pub markdown: Option<CowStr<'a>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContentRating<'a> {
General,
Teen,
Mature,
Explicit,
Other(CowStr<'a>),
}
impl<'a> ContentRating<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::General => "general",
Self::Teen => "teen",
Self::Mature => "mature",
Self::Explicit => "explicit",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ContentRating<'a> {
fn from(s: &'a str) -> Self {
match s {
"general" => Self::General,
"teen" => Self::Teen,
"mature" => Self::Mature,
"explicit" => Self::Explicit,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ContentRating<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"general" => Self::General,
"teen" => Self::Teen,
"mature" => Self::Mature,
"explicit" => Self::Explicit,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> AsRef<str> for ContentRating<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> core::fmt::Display for ContentRating<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> serde::Serialize for ContentRating<'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 ContentRating<'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 jacquard_common::IntoStatic for ContentRating<'_> {
type Output = ContentRating<'static>;
fn into_static(self) -> Self::Output {
match self {
ContentRating::General => ContentRating::General,
ContentRating::Teen => ContentRating::Teen,
ContentRating::Mature => ContentRating::Mature,
ContentRating::Explicit => ContentRating::Explicit,
ContentRating::Other(v) => ContentRating::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContentWarning<'a> {
Violence,
GraphicViolence,
Death,
MajorCharacterDeath,
SexualContent,
ExplicitSexualContent,
Language,
SubstanceUse,
SelfHarm,
Abuse,
DisturbingImagery,
Other(CowStr<'a>),
}
impl<'a> ContentWarning<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Violence => "violence",
Self::GraphicViolence => "graphic-violence",
Self::Death => "death",
Self::MajorCharacterDeath => "major-character-death",
Self::SexualContent => "sexual-content",
Self::ExplicitSexualContent => "explicit-sexual-content",
Self::Language => "language",
Self::SubstanceUse => "substance-use",
Self::SelfHarm => "self-harm",
Self::Abuse => "abuse",
Self::DisturbingImagery => "disturbing-imagery",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ContentWarning<'a> {
fn from(s: &'a str) -> Self {
match s {
"violence" => Self::Violence,
"graphic-violence" => Self::GraphicViolence,
"death" => Self::Death,
"major-character-death" => Self::MajorCharacterDeath,
"sexual-content" => Self::SexualContent,
"explicit-sexual-content" => Self::ExplicitSexualContent,
"language" => Self::Language,
"substance-use" => Self::SubstanceUse,
"self-harm" => Self::SelfHarm,
"abuse" => Self::Abuse,
"disturbing-imagery" => Self::DisturbingImagery,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ContentWarning<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"violence" => Self::Violence,
"graphic-violence" => Self::GraphicViolence,
"death" => Self::Death,
"major-character-death" => Self::MajorCharacterDeath,
"sexual-content" => Self::SexualContent,
"explicit-sexual-content" => Self::ExplicitSexualContent,
"language" => Self::Language,
"substance-use" => Self::SubstanceUse,
"self-harm" => Self::SelfHarm,
"abuse" => Self::Abuse,
"disturbing-imagery" => Self::DisturbingImagery,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> AsRef<str> for ContentWarning<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> core::fmt::Display for ContentWarning<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> serde::Serialize for ContentWarning<'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 ContentWarning<'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 jacquard_common::IntoStatic for ContentWarning<'_> {
type Output = ContentWarning<'static>;
fn into_static(self) -> Self::Output {
match self {
ContentWarning::Violence => ContentWarning::Violence,
ContentWarning::GraphicViolence => ContentWarning::GraphicViolence,
ContentWarning::Death => ContentWarning::Death,
ContentWarning::MajorCharacterDeath => ContentWarning::MajorCharacterDeath,
ContentWarning::SexualContent => ContentWarning::SexualContent,
ContentWarning::ExplicitSexualContent => {
ContentWarning::ExplicitSexualContent
}
ContentWarning::Language => ContentWarning::Language,
ContentWarning::SubstanceUse => ContentWarning::SubstanceUse,
ContentWarning::SelfHarm => ContentWarning::SelfHarm,
ContentWarning::Abuse => ContentWarning::Abuse,
ContentWarning::DisturbingImagery => ContentWarning::DisturbingImagery,
ContentWarning::Other(v) => ContentWarning::Other(v.into_static()),
}
}
}
pub type ContentWarnings<'a> = Vec<notebook::ContentWarning<'a>>;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EntryView<'a> {
#[serde(borrow)]
pub authors: Vec<notebook::AuthorListView<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bookmark_count: Option<i64>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub path: Option<notebook::Path<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub permissions: Option<notebook::PermissionsState<'a>>,
#[serde(borrow)]
pub record: Data<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub rendered_view: Option<notebook::RenderedView<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<notebook::Tags<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub title: Option<notebook::Title<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_bookmark: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_like: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_reading_progress: Option<notebook::ReadingProgress<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct FeedEntryView<'a> {
#[serde(borrow)]
pub entry: notebook::EntryView<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub notebook_context: Option<notebook::FeedNotebookContext<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub reason: Option<notebook::FeedReason<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct FeedNotebookContext<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub path: Option<CowStr<'a>>,
#[serde(borrow)]
pub title: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum FeedReason<'a> {
#[serde(rename = "sh.weaver.notebook.defs#reasonLike")]
ReasonLike(Box<notebook::ReasonLike<'a>>),
#[serde(rename = "sh.weaver.notebook.defs#reasonBookmark")]
ReasonBookmark(Box<notebook::ReasonBookmark<'a>>),
#[serde(rename = "sh.weaver.notebook.defs#reasonSubscription")]
ReasonSubscription(Box<notebook::ReasonSubscription<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotebookView<'a> {
#[serde(borrow)]
pub authors: Vec<notebook::AuthorListView<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bookmark_count: Option<i64>,
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub path: Option<notebook::Path<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub permissions: Option<notebook::PermissionsState<'a>>,
#[serde(borrow)]
pub record: Data<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriber_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<notebook::Tags<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub title: Option<notebook::Title<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_bookmark: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_like: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_reading_progress: Option<notebook::ReadingProgress<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_subscription: Option<AtUri<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PageView<'a> {
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
#[serde(borrow)]
pub notebook: notebook::NotebookView<'a>,
#[serde(borrow)]
pub record: Data<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<notebook::Tags<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub title: Option<notebook::Title<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
pub type Path<'a> = CowStr<'a>;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PermissionGrant<'a> {
#[serde(borrow)]
pub did: Did<'a>,
pub granted_at: Datetime,
#[serde(borrow)]
pub scope: PermissionGrantScope<'a>,
#[serde(borrow)]
pub source: AtUri<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PermissionGrantScope<'a> {
Direct,
Inherited,
Other(CowStr<'a>),
}
impl<'a> PermissionGrantScope<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Direct => "direct",
Self::Inherited => "inherited",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for PermissionGrantScope<'a> {
fn from(s: &'a str) -> Self {
match s {
"direct" => Self::Direct,
"inherited" => Self::Inherited,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for PermissionGrantScope<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"direct" => Self::Direct,
"inherited" => Self::Inherited,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for PermissionGrantScope<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for PermissionGrantScope<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for PermissionGrantScope<'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 PermissionGrantScope<'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 PermissionGrantScope<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for PermissionGrantScope<'_> {
type Output = PermissionGrantScope<'static>;
fn into_static(self) -> Self::Output {
match self {
PermissionGrantScope::Direct => PermissionGrantScope::Direct,
PermissionGrantScope::Inherited => PermissionGrantScope::Inherited,
PermissionGrantScope::Other(v) => {
PermissionGrantScope::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PermissionsState<'a> {
#[serde(borrow)]
pub editors: Vec<notebook::PermissionGrant<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewers: Option<Vec<notebook::PermissionGrant<'a>>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PublishedVersionView<'a> {
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub diverged_from: Option<StrongRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_canonical: Option<bool>,
pub published_at: Datetime,
#[serde(borrow)]
pub publisher: ProfileViewBasic<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReadingProgress<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub current_entry: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub finished_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_read_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_complete: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub status: Option<ReadingProgressStatus<'a>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReadingProgressStatus<'a> {
Reading,
Finished,
Abandoned,
WantToRead,
Other(CowStr<'a>),
}
impl<'a> ReadingProgressStatus<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Reading => "reading",
Self::Finished => "finished",
Self::Abandoned => "abandoned",
Self::WantToRead => "want-to-read",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ReadingProgressStatus<'a> {
fn from(s: &'a str) -> Self {
match s {
"reading" => Self::Reading,
"finished" => Self::Finished,
"abandoned" => Self::Abandoned,
"want-to-read" => Self::WantToRead,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ReadingProgressStatus<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"reading" => Self::Reading,
"finished" => Self::Finished,
"abandoned" => Self::Abandoned,
"want-to-read" => Self::WantToRead,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ReadingProgressStatus<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ReadingProgressStatus<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ReadingProgressStatus<'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 ReadingProgressStatus<'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 ReadingProgressStatus<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ReadingProgressStatus<'_> {
type Output = ReadingProgressStatus<'static>;
fn into_static(self) -> Self::Output {
match self {
ReadingProgressStatus::Reading => ReadingProgressStatus::Reading,
ReadingProgressStatus::Finished => ReadingProgressStatus::Finished,
ReadingProgressStatus::Abandoned => ReadingProgressStatus::Abandoned,
ReadingProgressStatus::WantToRead => ReadingProgressStatus::WantToRead,
ReadingProgressStatus::Other(v) => {
ReadingProgressStatus::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReasonBookmark<'a> {
#[serde(borrow)]
pub by: ProfileViewBasic<'a>,
pub indexed_at: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReasonLike<'a> {
#[serde(borrow)]
pub by: ProfileViewBasic<'a>,
pub indexed_at: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReasonSubscription<'a> {
pub indexed_at: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RenderedView<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub css: Option<BlobRef<'a>>,
#[serde(borrow)]
pub html: BlobRef<'a>,
}
pub type Tags<'a> = Vec<CowStr<'a>>;
pub type Title<'a> = CowStr<'a>;
impl<'a> LexiconSchema for AuthorListView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"authorListView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for BookEntryRef<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"bookEntryRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for BookEntryView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"bookEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ChapterEntryView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"chapterEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ChapterView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"chapterView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ContentFormat<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"contentFormat"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for EntryView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"entryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for FeedEntryView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"feedEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for FeedNotebookContext<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"feedNotebookContext"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for NotebookView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"notebookView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for PageView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"pageView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for PermissionGrant<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"permissionGrant"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for PermissionsState<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"permissionsState"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for PublishedVersionView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"publishedVersionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ReadingProgress<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"readingProgress"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.percent_complete {
if *value > 100i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("percent_complete"),
max: 100i64,
actual: *value,
});
}
}
if let Some(ref value) = self.percent_complete {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("percent_complete"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ReasonBookmark<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonBookmark"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ReasonLike<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonLike"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ReasonSubscription<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonSubscription"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for RenderedView<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"renderedView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.css {
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("css"),
max: 1000000usize,
actual: size,
});
}
}
}
if let Some(ref value) = self.css {
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["text/css"];
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(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("css"),
accepted: vec!["text/css".to_string()],
actual: mime.to_string(),
});
}
}
}
{
let value = &self.html;
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("html"),
max: 1000000usize,
actual: size,
});
}
}
}
{
let value = &self.html;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["text/html"];
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(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("html"),
accepted: vec!["text/html".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
pub mod author_list_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 Record;
type Index;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
type Index = Unset;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Record = Set<members::record>;
type Index = S::Index;
}
pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndex<S> {}
impl<S: State> State for SetIndex<S> {
type Record = S::Record;
type Index = Set<members::index>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
pub struct index(());
}
}
pub struct AuthorListViewBuilder<'a, S: author_list_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<ProfileDataView<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> AuthorListView<'a> {
pub fn new() -> AuthorListViewBuilder<'a, author_list_view_state::Empty> {
AuthorListViewBuilder::new()
}
}
impl<'a> AuthorListViewBuilder<'a, author_list_view_state::Empty> {
pub fn new() -> Self {
AuthorListViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> AuthorListViewBuilder<'a, S>
where
S: author_list_view_state::State,
S::Index: author_list_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> AuthorListViewBuilder<'a, author_list_view_state::SetIndex<S>> {
self._fields.0 = Option::Some(value.into());
AuthorListViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> AuthorListViewBuilder<'a, S>
where
S: author_list_view_state::State,
S::Record: author_list_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<ProfileDataView<'a>>,
) -> AuthorListViewBuilder<'a, author_list_view_state::SetRecord<S>> {
self._fields.1 = Option::Some(value.into());
AuthorListViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: author_list_view_state::State> AuthorListViewBuilder<'a, S> {
pub fn uri(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_uri(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> AuthorListViewBuilder<'a, S>
where
S: author_list_view_state::State,
S::Record: author_list_view_state::IsSet,
S::Index: author_list_view_state::IsSet,
{
pub fn build(self) -> AuthorListView<'a> {
AuthorListView {
index: self._fields.0.unwrap(),
record: self._fields.1.unwrap(),
uri: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> AuthorListView<'a> {
AuthorListView {
index: self._fields.0.unwrap(),
record: self._fields.1.unwrap(),
uri: self._fields.2,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_notebook_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.notebook.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authorListView"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("record"), SmolStr::new_static("index")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileDataView",
),
..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("bookEntryRef"),
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("#entryView"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookEntryView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("An ordered entry in a Weaver notebook."),
),
required: Some(
vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("next"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prev"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chapterEntryView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("An entry within a chapter context."),
),
required: Some(
vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("next"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prev"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chapterView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Hydrated view of a chapter.")),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("notebook"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebook"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#notebookView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..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("contentFormat"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The format of the content. This is used to determine how to render the content.",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("markdown"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The format of the content. This is used to determine how to render the content.",
),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentRating"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static("Author-applied content rating."),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentWarning"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static("Author-applied content warning."),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentWarnings"),
LexUserType::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#contentWarning"),
..Default::default()
}),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookmarkCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#path"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#permissionsState"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("renderedView"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#renderedView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerBookmark"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerLike"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerReadingProgress"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#readingProgress"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("feedEntryView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Entry with feed-specific context (discovery reason, notebook context).",
),
),
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("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookContext"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#feedNotebookContext"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reason"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#feedReason"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("feedNotebookContext"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Minimal notebook context for feed display."),
),
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("title")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("title"),
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("feedReason"),
LexUserType::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#reasonLike"),
CowStr::new_static("#reasonBookmark"),
CowStr::new_static("#reasonSubscription")
],
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookmarkCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#path"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#permissionsState"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subscriberCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerBookmark"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerLike"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerReadingProgress"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#readingProgress"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerSubscription"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pageView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Hydrated view of a page (entries displayed together).",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("notebook"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebook"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#notebookView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..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("path"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("The path of the notebook.")),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissionGrant"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A single permission grant. For resource authority: source=resource URI, grantedAt=createdAt. For invitees: source=invite URI, grantedAt=accept createdAt.",
),
),
required: Some(
vec![
SmolStr::new_static("did"), SmolStr::new_static("scope"),
SmolStr::new_static("source"),
SmolStr::new_static("grantedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("grantedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"For authority: record createdAt. For invitees: accept createdAt",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("scope"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"direct = this resource (includes authority), inherited = via notebook invite",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"For authority: resource URI. For invitees: invite URI",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissionsState"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"ACL-style permissions for a resource. Separate from authors (who contributed).",
),
),
required: Some(vec![SmolStr::new_static("editors")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("editors"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("DIDs that can edit this resource"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#permissionGrant"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewers"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("DIDs that can view (future use)"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#permissionGrant"),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedVersionView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A published version of an entry in a collaborator's repo.",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("publisher"),
SmolStr::new_static("publishedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("divergedFrom"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isCanonical"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publisher"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..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("readingProgress"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Viewer's reading progress (appview-side state, not a record).",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("currentEntry"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Last entry the viewer was reading."),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("finishedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastReadAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("percentComplete"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(100i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("startedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonBookmark"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("by"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonLike"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("by"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonSubscription"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("indexedAt")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("renderedView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"View of a rendered and cached notebook entry",
),
),
required: Some(vec![SmolStr::new_static("html")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("css"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("html"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexUserType::Array(LexArray {
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static("The title of the notebook entry."),
),
max_length: Some(300usize),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod book_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 BookEntryRefBuilder<'a, S: book_entry_ref_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<notebook::EntryView<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> BookEntryRef<'a> {
pub fn new() -> BookEntryRefBuilder<'a, book_entry_ref_state::Empty> {
BookEntryRefBuilder::new()
}
}
impl<'a> BookEntryRefBuilder<'a, book_entry_ref_state::Empty> {
pub fn new() -> Self {
BookEntryRefBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> BookEntryRefBuilder<'a, S>
where
S: book_entry_ref_state::State,
S::Entry: book_entry_ref_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<'a>>,
) -> BookEntryRefBuilder<'a, book_entry_ref_state::SetEntry<S>> {
self._fields.0 = Option::Some(value.into());
BookEntryRefBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> BookEntryRefBuilder<'a, S>
where
S: book_entry_ref_state::State,
S::Entry: book_entry_ref_state::IsSet,
{
pub fn build(self) -> BookEntryRef<'a> {
BookEntryRef {
entry: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> BookEntryRef<'a> {
BookEntryRef {
entry: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod book_entry_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 Index;
type Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Index = Unset;
type Entry = Unset;
}
pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndex<S> {}
impl<S: State> State for SetIndex<S> {
type Index = Set<members::index>;
type Entry = S::Entry;
}
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 Index = S::Index;
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct index(());
pub struct entry(());
}
}
pub struct BookEntryViewBuilder<'a, S: book_entry_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<notebook::EntryView<'a>>,
Option<i64>,
Option<notebook::BookEntryRef<'a>>,
Option<notebook::BookEntryRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> BookEntryView<'a> {
pub fn new() -> BookEntryViewBuilder<'a, book_entry_view_state::Empty> {
BookEntryViewBuilder::new()
}
}
impl<'a> BookEntryViewBuilder<'a, book_entry_view_state::Empty> {
pub fn new() -> Self {
BookEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> BookEntryViewBuilder<'a, S>
where
S: book_entry_view_state::State,
S::Entry: book_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<'a>>,
) -> BookEntryViewBuilder<'a, book_entry_view_state::SetEntry<S>> {
self._fields.0 = Option::Some(value.into());
BookEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> BookEntryViewBuilder<'a, S>
where
S: book_entry_view_state::State,
S::Index: book_entry_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> BookEntryViewBuilder<'a, book_entry_view_state::SetIndex<S>> {
self._fields.1 = Option::Some(value.into());
BookEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: book_entry_view_state::State> BookEntryViewBuilder<'a, S> {
pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: book_entry_view_state::State> BookEntryViewBuilder<'a, S> {
pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> BookEntryViewBuilder<'a, S>
where
S: book_entry_view_state::State,
S::Index: book_entry_view_state::IsSet,
S::Entry: book_entry_view_state::IsSet,
{
pub fn build(self) -> BookEntryView<'a> {
BookEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> BookEntryView<'a> {
BookEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod chapter_entry_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 Index;
type Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Index = Unset;
type Entry = Unset;
}
pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndex<S> {}
impl<S: State> State for SetIndex<S> {
type Index = Set<members::index>;
type Entry = S::Entry;
}
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 Index = S::Index;
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct index(());
pub struct entry(());
}
}
pub struct ChapterEntryViewBuilder<'a, S: chapter_entry_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<notebook::EntryView<'a>>,
Option<i64>,
Option<notebook::BookEntryRef<'a>>,
Option<notebook::BookEntryRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ChapterEntryView<'a> {
pub fn new() -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::Empty> {
ChapterEntryViewBuilder::new()
}
}
impl<'a> ChapterEntryViewBuilder<'a, chapter_entry_view_state::Empty> {
pub fn new() -> Self {
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterEntryViewBuilder<'a, S>
where
S: chapter_entry_view_state::State,
S::Entry: chapter_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<'a>>,
) -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::SetEntry<S>> {
self._fields.0 = Option::Some(value.into());
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterEntryViewBuilder<'a, S>
where
S: chapter_entry_view_state::State,
S::Index: chapter_entry_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> ChapterEntryViewBuilder<'a, chapter_entry_view_state::SetIndex<S>> {
self._fields.1 = Option::Some(value.into());
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: chapter_entry_view_state::State> ChapterEntryViewBuilder<'a, S> {
pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: chapter_entry_view_state::State> ChapterEntryViewBuilder<'a, S> {
pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> ChapterEntryViewBuilder<'a, S>
where
S: chapter_entry_view_state::State,
S::Index: chapter_entry_view_state::IsSet,
S::Entry: chapter_entry_view_state::IsSet,
{
pub fn build(self) -> ChapterEntryView<'a> {
ChapterEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ChapterEntryView<'a> {
ChapterEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod chapter_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 Cid;
type Notebook;
type Record;
type Uri;
type IndexedAt;
type Authors;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type Notebook = Unset;
type Record = Unset;
type Uri = Unset;
type IndexedAt = Unset;
type Authors = 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 Notebook = S::Notebook;
type Record = S::Record;
type Uri = S::Uri;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
}
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 Cid = S::Cid;
type Notebook = Set<members::notebook>;
type Record = S::Record;
type Uri = S::Uri;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Cid = S::Cid;
type Notebook = S::Notebook;
type Record = Set<members::record>;
type Uri = S::Uri;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
}
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 Notebook = S::Notebook;
type Record = S::Record;
type Uri = Set<members::uri>;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type Cid = S::Cid;
type Notebook = S::Notebook;
type Record = S::Record;
type Uri = S::Uri;
type IndexedAt = Set<members::indexed_at>;
type Authors = S::Authors;
}
pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthors<S> {}
impl<S: State> State for SetAuthors<S> {
type Cid = S::Cid;
type Notebook = S::Notebook;
type Record = S::Record;
type Uri = S::Uri;
type IndexedAt = S::IndexedAt;
type Authors = Set<members::authors>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct notebook(());
pub struct record(());
pub struct uri(());
pub struct indexed_at(());
pub struct authors(());
}
}
pub struct ChapterViewBuilder<'a, S: chapter_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<notebook::AuthorListView<'a>>>,
Option<Cid<'a>>,
Option<i64>,
Option<Datetime>,
Option<notebook::NotebookView<'a>>,
Option<Data<'a>>,
Option<notebook::Tags<'a>>,
Option<notebook::Title<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ChapterView<'a> {
pub fn new() -> ChapterViewBuilder<'a, chapter_view_state::Empty> {
ChapterViewBuilder::new()
}
}
impl<'a> ChapterViewBuilder<'a, chapter_view_state::Empty> {
pub fn new() -> Self {
ChapterViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Authors: chapter_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<'a>>>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetAuthors<S>> {
self._fields.0 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Cid: chapter_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::IndexedAt: chapter_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetIndexedAt<S>> {
self._fields.3 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Notebook: chapter_view_state::IsUnset,
{
pub fn notebook(
mut self,
value: impl Into<notebook::NotebookView<'a>>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetNotebook<S>> {
self._fields.4 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Record: chapter_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<'a>>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetRecord<S>> {
self._fields.5 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: chapter_view_state::State> ChapterViewBuilder<'a, S> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Uri: chapter_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ChapterViewBuilder<'a, chapter_view_state::SetUri<S>> {
self._fields.8 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ChapterViewBuilder<'a, S>
where
S: chapter_view_state::State,
S::Cid: chapter_view_state::IsSet,
S::Notebook: chapter_view_state::IsSet,
S::Record: chapter_view_state::IsSet,
S::Uri: chapter_view_state::IsSet,
S::IndexedAt: chapter_view_state::IsSet,
S::Authors: chapter_view_state::IsSet,
{
pub fn build(self) -> ChapterView<'a> {
ChapterView {
authors: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
entry_count: self._fields.2,
indexed_at: self._fields.3.unwrap(),
notebook: self._fields.4.unwrap(),
record: self._fields.5.unwrap(),
tags: self._fields.6,
title: self._fields.7,
uri: self._fields.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ChapterView<'a> {
ChapterView {
authors: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
entry_count: self._fields.2,
indexed_at: self._fields.3.unwrap(),
notebook: self._fields.4.unwrap(),
record: self._fields.5.unwrap(),
tags: self._fields.6,
title: self._fields.7,
uri: self._fields.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn _default_content_format_markdown() -> Option<CowStr<'static>> {
Some(CowStr::from("weaver"))
}
impl Default for ContentFormat<'_> {
fn default() -> Self {
Self {
markdown: Some(CowStr::from("weaver")),
extra_data: Default::default(),
}
}
}
pub mod entry_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 Authors;
type IndexedAt;
type Record;
type Uri;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Authors = Unset;
type IndexedAt = Unset;
type Record = Unset;
type Uri = Unset;
type Cid = Unset;
}
pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthors<S> {}
impl<S: State> State for SetAuthors<S> {
type Authors = Set<members::authors>;
type IndexedAt = S::IndexedAt;
type Record = S::Record;
type Uri = S::Uri;
type Cid = S::Cid;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type Authors = S::Authors;
type IndexedAt = Set<members::indexed_at>;
type Record = S::Record;
type Uri = S::Uri;
type Cid = S::Cid;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Authors = S::Authors;
type IndexedAt = S::IndexedAt;
type Record = Set<members::record>;
type Uri = S::Uri;
type Cid = S::Cid;
}
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 Authors = S::Authors;
type IndexedAt = S::IndexedAt;
type Record = S::Record;
type Uri = Set<members::uri>;
type Cid = S::Cid;
}
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 Authors = S::Authors;
type IndexedAt = S::IndexedAt;
type Record = S::Record;
type Uri = S::Uri;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct authors(());
pub struct indexed_at(());
pub struct record(());
pub struct uri(());
pub struct cid(());
}
}
pub struct EntryViewBuilder<'a, S: entry_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<notebook::AuthorListView<'a>>>,
Option<i64>,
Option<Cid<'a>>,
Option<Datetime>,
Option<i64>,
Option<notebook::Path<'a>>,
Option<notebook::PermissionsState<'a>>,
Option<Data<'a>>,
Option<notebook::RenderedView<'a>>,
Option<notebook::Tags<'a>>,
Option<notebook::Title<'a>>,
Option<AtUri<'a>>,
Option<AtUri<'a>>,
Option<AtUri<'a>>,
Option<notebook::ReadingProgress<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> EntryView<'a> {
pub fn new() -> EntryViewBuilder<'a, entry_view_state::Empty> {
EntryViewBuilder::new()
}
}
impl<'a> EntryViewBuilder<'a, entry_view_state::Empty> {
pub fn new() -> Self {
EntryViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::Authors: entry_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<'a>>>,
) -> EntryViewBuilder<'a, entry_view_state::SetAuthors<S>> {
self._fields.0 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::Cid: entry_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> EntryViewBuilder<'a, entry_view_state::SetCid<S>> {
self._fields.2 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::IndexedAt: entry_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> EntryViewBuilder<'a, entry_view_state::SetIndexedAt<S>> {
self._fields.3 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn path(mut self, value: impl Into<Option<notebook::Path<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<notebook::Path<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn permissions(
mut self,
value: impl Into<Option<notebook::PermissionsState<'a>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_permissions(
mut self,
value: Option<notebook::PermissionsState<'a>>,
) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::Record: entry_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<'a>>,
) -> EntryViewBuilder<'a, entry_view_state::SetRecord<S>> {
self._fields.7 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn rendered_view(
mut self,
value: impl Into<Option<notebook::RenderedView<'a>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_rendered_view(
mut self,
value: Option<notebook::RenderedView<'a>>,
) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
self._fields.10 = value;
self
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::Uri: entry_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> EntryViewBuilder<'a, entry_view_state::SetUri<S>> {
self._fields.11 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.12 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn viewer_like(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_viewer_like(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.13 = value;
self
}
}
impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> {
pub fn viewer_reading_progress(
mut self,
value: impl Into<Option<notebook::ReadingProgress<'a>>>,
) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_viewer_reading_progress(
mut self,
value: Option<notebook::ReadingProgress<'a>>,
) -> Self {
self._fields.14 = value;
self
}
}
impl<'a, S> EntryViewBuilder<'a, S>
where
S: entry_view_state::State,
S::Authors: entry_view_state::IsSet,
S::IndexedAt: entry_view_state::IsSet,
S::Record: entry_view_state::IsSet,
S::Uri: entry_view_state::IsSet,
S::Cid: entry_view_state::IsSet,
{
pub fn build(self) -> EntryView<'a> {
EntryView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
indexed_at: self._fields.3.unwrap(),
like_count: self._fields.4,
path: self._fields.5,
permissions: self._fields.6,
record: self._fields.7.unwrap(),
rendered_view: self._fields.8,
tags: self._fields.9,
title: self._fields.10,
uri: self._fields.11.unwrap(),
viewer_bookmark: self._fields.12,
viewer_like: self._fields.13,
viewer_reading_progress: self._fields.14,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> EntryView<'a> {
EntryView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
indexed_at: self._fields.3.unwrap(),
like_count: self._fields.4,
path: self._fields.5,
permissions: self._fields.6,
record: self._fields.7.unwrap(),
rendered_view: self._fields.8,
tags: self._fields.9,
title: self._fields.10,
uri: self._fields.11.unwrap(),
viewer_bookmark: self._fields.12,
viewer_like: self._fields.13,
viewer_reading_progress: self._fields.14,
extra_data: Some(extra_data),
}
}
}
pub mod feed_entry_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 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 FeedEntryViewBuilder<'a, S: feed_entry_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<notebook::EntryView<'a>>,
Option<notebook::FeedNotebookContext<'a>>,
Option<notebook::FeedReason<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> FeedEntryView<'a> {
pub fn new() -> FeedEntryViewBuilder<'a, feed_entry_view_state::Empty> {
FeedEntryViewBuilder::new()
}
}
impl<'a> FeedEntryViewBuilder<'a, feed_entry_view_state::Empty> {
pub fn new() -> Self {
FeedEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> FeedEntryViewBuilder<'a, S>
where
S: feed_entry_view_state::State,
S::Entry: feed_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<'a>>,
) -> FeedEntryViewBuilder<'a, feed_entry_view_state::SetEntry<S>> {
self._fields.0 = Option::Some(value.into());
FeedEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: feed_entry_view_state::State> FeedEntryViewBuilder<'a, S> {
pub fn notebook_context(
mut self,
value: impl Into<Option<notebook::FeedNotebookContext<'a>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_notebook_context(
mut self,
value: Option<notebook::FeedNotebookContext<'a>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: feed_entry_view_state::State> FeedEntryViewBuilder<'a, S> {
pub fn reason(mut self, value: impl Into<Option<notebook::FeedReason<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_reason(mut self, value: Option<notebook::FeedReason<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> FeedEntryViewBuilder<'a, S>
where
S: feed_entry_view_state::State,
S::Entry: feed_entry_view_state::IsSet,
{
pub fn build(self) -> FeedEntryView<'a> {
FeedEntryView {
entry: self._fields.0.unwrap(),
notebook_context: self._fields.1,
reason: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> FeedEntryView<'a> {
FeedEntryView {
entry: self._fields.0.unwrap(),
notebook_context: self._fields.1,
reason: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod feed_notebook_context_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 Uri;
type Title;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Title = Unset;
}
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 Uri = Set<members::uri>;
type Title = S::Title;
}
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 Uri = S::Uri;
type Title = Set<members::title>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct title(());
}
}
pub struct FeedNotebookContextBuilder<'a, S: feed_notebook_context_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> FeedNotebookContext<'a> {
pub fn new() -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::Empty> {
FeedNotebookContextBuilder::new()
}
}
impl<'a> FeedNotebookContextBuilder<'a, feed_notebook_context_state::Empty> {
pub fn new() -> Self {
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: feed_notebook_context_state::State> FeedNotebookContextBuilder<'a, S> {
pub fn path(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> FeedNotebookContextBuilder<'a, S>
where
S: feed_notebook_context_state::State,
S::Title: feed_notebook_context_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<CowStr<'a>>,
) -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::SetTitle<S>> {
self._fields.1 = Option::Some(value.into());
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FeedNotebookContextBuilder<'a, S>
where
S: feed_notebook_context_state::State,
S::Uri: feed_notebook_context_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> FeedNotebookContextBuilder<'a, feed_notebook_context_state::SetUri<S>> {
self._fields.2 = Option::Some(value.into());
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FeedNotebookContextBuilder<'a, S>
where
S: feed_notebook_context_state::State,
S::Uri: feed_notebook_context_state::IsSet,
S::Title: feed_notebook_context_state::IsSet,
{
pub fn build(self) -> FeedNotebookContext<'a> {
FeedNotebookContext {
path: self._fields.0,
title: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> FeedNotebookContext<'a> {
FeedNotebookContext {
path: self._fields.0,
title: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod notebook_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 Record;
type IndexedAt;
type Authors;
type Cid;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
type IndexedAt = Unset;
type Authors = Unset;
type Cid = Unset;
type Uri = Unset;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Record = Set<members::record>;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
type Cid = S::Cid;
type Uri = S::Uri;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type Record = S::Record;
type IndexedAt = Set<members::indexed_at>;
type Authors = S::Authors;
type Cid = S::Cid;
type Uri = S::Uri;
}
pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthors<S> {}
impl<S: State> State for SetAuthors<S> {
type Record = S::Record;
type IndexedAt = S::IndexedAt;
type Authors = Set<members::authors>;
type Cid = S::Cid;
type Uri = S::Uri;
}
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 Record = S::Record;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
type Cid = Set<members::cid>;
type Uri = S::Uri;
}
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 Record = S::Record;
type IndexedAt = S::IndexedAt;
type Authors = S::Authors;
type Cid = S::Cid;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
pub struct indexed_at(());
pub struct authors(());
pub struct cid(());
pub struct uri(());
}
}
pub struct NotebookViewBuilder<'a, S: notebook_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<notebook::AuthorListView<'a>>>,
Option<i64>,
Option<Cid<'a>>,
Option<i64>,
Option<Datetime>,
Option<i64>,
Option<notebook::Path<'a>>,
Option<notebook::PermissionsState<'a>>,
Option<Data<'a>>,
Option<i64>,
Option<notebook::Tags<'a>>,
Option<notebook::Title<'a>>,
Option<AtUri<'a>>,
Option<AtUri<'a>>,
Option<AtUri<'a>>,
Option<notebook::ReadingProgress<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> NotebookView<'a> {
pub fn new() -> NotebookViewBuilder<'a, notebook_view_state::Empty> {
NotebookViewBuilder::new()
}
}
impl<'a> NotebookViewBuilder<'a, notebook_view_state::Empty> {
pub fn new() -> Self {
NotebookViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::Authors: notebook_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<'a>>>,
) -> NotebookViewBuilder<'a, notebook_view_state::SetAuthors<S>> {
self._fields.0 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::Cid: notebook_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> NotebookViewBuilder<'a, notebook_view_state::SetCid<S>> {
self._fields.2 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::IndexedAt: notebook_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> NotebookViewBuilder<'a, notebook_view_state::SetIndexedAt<S>> {
self._fields.4 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn path(mut self, value: impl Into<Option<notebook::Path<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<notebook::Path<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn permissions(
mut self,
value: impl Into<Option<notebook::PermissionsState<'a>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_permissions(
mut self,
value: Option<notebook::PermissionsState<'a>>,
) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::Record: notebook_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<'a>>,
) -> NotebookViewBuilder<'a, notebook_view_state::SetRecord<S>> {
self._fields.8 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn subscriber_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_subscriber_count(mut self, value: Option<i64>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
self._fields.10 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
self._fields.11 = value;
self
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::Uri: notebook_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> NotebookViewBuilder<'a, notebook_view_state::SetUri<S>> {
self._fields.12 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.13 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn viewer_like(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_viewer_like(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.14 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn viewer_reading_progress(
mut self,
value: impl Into<Option<notebook::ReadingProgress<'a>>>,
) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_viewer_reading_progress(
mut self,
value: Option<notebook::ReadingProgress<'a>>,
) -> Self {
self._fields.15 = value;
self
}
}
impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> {
pub fn viewer_subscription(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_viewer_subscription(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.16 = value;
self
}
}
impl<'a, S> NotebookViewBuilder<'a, S>
where
S: notebook_view_state::State,
S::Record: notebook_view_state::IsSet,
S::IndexedAt: notebook_view_state::IsSet,
S::Authors: notebook_view_state::IsSet,
S::Cid: notebook_view_state::IsSet,
S::Uri: notebook_view_state::IsSet,
{
pub fn build(self) -> NotebookView<'a> {
NotebookView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
entry_count: self._fields.3,
indexed_at: self._fields.4.unwrap(),
like_count: self._fields.5,
path: self._fields.6,
permissions: self._fields.7,
record: self._fields.8.unwrap(),
subscriber_count: self._fields.9,
tags: self._fields.10,
title: self._fields.11,
uri: self._fields.12.unwrap(),
viewer_bookmark: self._fields.13,
viewer_like: self._fields.14,
viewer_reading_progress: self._fields.15,
viewer_subscription: self._fields.16,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> NotebookView<'a> {
NotebookView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
entry_count: self._fields.3,
indexed_at: self._fields.4.unwrap(),
like_count: self._fields.5,
path: self._fields.6,
permissions: self._fields.7,
record: self._fields.8.unwrap(),
subscriber_count: self._fields.9,
tags: self._fields.10,
title: self._fields.11,
uri: self._fields.12.unwrap(),
viewer_bookmark: self._fields.13,
viewer_like: self._fields.14,
viewer_reading_progress: self._fields.15,
viewer_subscription: self._fields.16,
extra_data: Some(extra_data),
}
}
}
pub mod page_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 IndexedAt;
type Notebook;
type Record;
type Cid;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type IndexedAt = Unset;
type Notebook = Unset;
type Record = Unset;
type Cid = Unset;
type Uri = Unset;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type IndexedAt = Set<members::indexed_at>;
type Notebook = S::Notebook;
type Record = S::Record;
type Cid = S::Cid;
type Uri = S::Uri;
}
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 IndexedAt = S::IndexedAt;
type Notebook = Set<members::notebook>;
type Record = S::Record;
type Cid = S::Cid;
type Uri = S::Uri;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type IndexedAt = S::IndexedAt;
type Notebook = S::Notebook;
type Record = Set<members::record>;
type Cid = S::Cid;
type Uri = S::Uri;
}
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 IndexedAt = S::IndexedAt;
type Notebook = S::Notebook;
type Record = S::Record;
type Cid = Set<members::cid>;
type Uri = S::Uri;
}
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 IndexedAt = S::IndexedAt;
type Notebook = S::Notebook;
type Record = S::Record;
type Cid = S::Cid;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct indexed_at(());
pub struct notebook(());
pub struct record(());
pub struct cid(());
pub struct uri(());
}
}
pub struct PageViewBuilder<'a, S: page_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Cid<'a>>,
Option<i64>,
Option<Datetime>,
Option<notebook::NotebookView<'a>>,
Option<Data<'a>>,
Option<notebook::Tags<'a>>,
Option<notebook::Title<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PageView<'a> {
pub fn new() -> PageViewBuilder<'a, page_view_state::Empty> {
PageViewBuilder::new()
}
}
impl<'a> PageViewBuilder<'a, page_view_state::Empty> {
pub fn new() -> Self {
PageViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::Cid: page_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> PageViewBuilder<'a, page_view_state::SetCid<S>> {
self._fields.0 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::IndexedAt: page_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> PageViewBuilder<'a, page_view_state::SetIndexedAt<S>> {
self._fields.2 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::Notebook: page_view_state::IsUnset,
{
pub fn notebook(
mut self,
value: impl Into<notebook::NotebookView<'a>>,
) -> PageViewBuilder<'a, page_view_state::SetNotebook<S>> {
self._fields.3 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::Record: page_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<'a>>,
) -> PageViewBuilder<'a, page_view_state::SetRecord<S>> {
self._fields.4 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: page_view_state::State> PageViewBuilder<'a, S> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::Uri: page_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> PageViewBuilder<'a, page_view_state::SetUri<S>> {
self._fields.7 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PageViewBuilder<'a, S>
where
S: page_view_state::State,
S::IndexedAt: page_view_state::IsSet,
S::Notebook: page_view_state::IsSet,
S::Record: page_view_state::IsSet,
S::Cid: page_view_state::IsSet,
S::Uri: page_view_state::IsSet,
{
pub fn build(self) -> PageView<'a> {
PageView {
cid: self._fields.0.unwrap(),
entry_count: self._fields.1,
indexed_at: self._fields.2.unwrap(),
notebook: self._fields.3.unwrap(),
record: self._fields.4.unwrap(),
tags: self._fields.5,
title: self._fields.6,
uri: self._fields.7.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> PageView<'a> {
PageView {
cid: self._fields.0.unwrap(),
entry_count: self._fields.1,
indexed_at: self._fields.2.unwrap(),
notebook: self._fields.3.unwrap(),
record: self._fields.4.unwrap(),
tags: self._fields.5,
title: self._fields.6,
uri: self._fields.7.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod permission_grant_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 Scope;
type Did;
type GrantedAt;
type Source;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Scope = Unset;
type Did = Unset;
type GrantedAt = Unset;
type Source = Unset;
}
pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetScope<S> {}
impl<S: State> State for SetScope<S> {
type Scope = Set<members::scope>;
type Did = S::Did;
type GrantedAt = S::GrantedAt;
type Source = S::Source;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Scope = S::Scope;
type Did = Set<members::did>;
type GrantedAt = S::GrantedAt;
type Source = S::Source;
}
pub struct SetGrantedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetGrantedAt<S> {}
impl<S: State> State for SetGrantedAt<S> {
type Scope = S::Scope;
type Did = S::Did;
type GrantedAt = Set<members::granted_at>;
type Source = S::Source;
}
pub struct SetSource<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSource<S> {}
impl<S: State> State for SetSource<S> {
type Scope = S::Scope;
type Did = S::Did;
type GrantedAt = S::GrantedAt;
type Source = Set<members::source>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct scope(());
pub struct did(());
pub struct granted_at(());
pub struct source(());
}
}
pub struct PermissionGrantBuilder<'a, S: permission_grant_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Did<'a>>,
Option<Datetime>,
Option<PermissionGrantScope<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PermissionGrant<'a> {
pub fn new() -> PermissionGrantBuilder<'a, permission_grant_state::Empty> {
PermissionGrantBuilder::new()
}
}
impl<'a> PermissionGrantBuilder<'a, permission_grant_state::Empty> {
pub fn new() -> Self {
PermissionGrantBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionGrantBuilder<'a, S>
where
S: permission_grant_state::State,
S::Did: permission_grant_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<'a>>,
) -> PermissionGrantBuilder<'a, permission_grant_state::SetDid<S>> {
self._fields.0 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionGrantBuilder<'a, S>
where
S: permission_grant_state::State,
S::GrantedAt: permission_grant_state::IsUnset,
{
pub fn granted_at(
mut self,
value: impl Into<Datetime>,
) -> PermissionGrantBuilder<'a, permission_grant_state::SetGrantedAt<S>> {
self._fields.1 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionGrantBuilder<'a, S>
where
S: permission_grant_state::State,
S::Scope: permission_grant_state::IsUnset,
{
pub fn scope(
mut self,
value: impl Into<PermissionGrantScope<'a>>,
) -> PermissionGrantBuilder<'a, permission_grant_state::SetScope<S>> {
self._fields.2 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionGrantBuilder<'a, S>
where
S: permission_grant_state::State,
S::Source: permission_grant_state::IsUnset,
{
pub fn source(
mut self,
value: impl Into<AtUri<'a>>,
) -> PermissionGrantBuilder<'a, permission_grant_state::SetSource<S>> {
self._fields.3 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionGrantBuilder<'a, S>
where
S: permission_grant_state::State,
S::Scope: permission_grant_state::IsSet,
S::Did: permission_grant_state::IsSet,
S::GrantedAt: permission_grant_state::IsSet,
S::Source: permission_grant_state::IsSet,
{
pub fn build(self) -> PermissionGrant<'a> {
PermissionGrant {
did: self._fields.0.unwrap(),
granted_at: self._fields.1.unwrap(),
scope: self._fields.2.unwrap(),
source: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> PermissionGrant<'a> {
PermissionGrant {
did: self._fields.0.unwrap(),
granted_at: self._fields.1.unwrap(),
scope: self._fields.2.unwrap(),
source: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod permissions_state_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 Editors;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Editors = Unset;
}
pub struct SetEditors<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetEditors<S> {}
impl<S: State> State for SetEditors<S> {
type Editors = Set<members::editors>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct editors(());
}
}
pub struct PermissionsStateBuilder<'a, S: permissions_state_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<notebook::PermissionGrant<'a>>>,
Option<Vec<notebook::PermissionGrant<'a>>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PermissionsState<'a> {
pub fn new() -> PermissionsStateBuilder<'a, permissions_state_state::Empty> {
PermissionsStateBuilder::new()
}
}
impl<'a> PermissionsStateBuilder<'a, permissions_state_state::Empty> {
pub fn new() -> Self {
PermissionsStateBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PermissionsStateBuilder<'a, S>
where
S: permissions_state_state::State,
S::Editors: permissions_state_state::IsUnset,
{
pub fn editors(
mut self,
value: impl Into<Vec<notebook::PermissionGrant<'a>>>,
) -> PermissionsStateBuilder<'a, permissions_state_state::SetEditors<S>> {
self._fields.0 = Option::Some(value.into());
PermissionsStateBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: permissions_state_state::State> PermissionsStateBuilder<'a, S> {
pub fn viewers(
mut self,
value: impl Into<Option<Vec<notebook::PermissionGrant<'a>>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_viewers(
mut self,
value: Option<Vec<notebook::PermissionGrant<'a>>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> PermissionsStateBuilder<'a, S>
where
S: permissions_state_state::State,
S::Editors: permissions_state_state::IsSet,
{
pub fn build(self) -> PermissionsState<'a> {
PermissionsState {
editors: self._fields.0.unwrap(),
viewers: self._fields.1,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> PermissionsState<'a> {
PermissionsState {
editors: self._fields.0.unwrap(),
viewers: self._fields.1,
extra_data: Some(extra_data),
}
}
}
pub mod published_version_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 Publisher;
type Uri;
type PublishedAt;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Publisher = Unset;
type Uri = Unset;
type PublishedAt = Unset;
type Cid = Unset;
}
pub struct SetPublisher<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPublisher<S> {}
impl<S: State> State for SetPublisher<S> {
type Publisher = Set<members::publisher>;
type Uri = S::Uri;
type PublishedAt = S::PublishedAt;
type Cid = S::Cid;
}
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 Publisher = S::Publisher;
type Uri = Set<members::uri>;
type PublishedAt = S::PublishedAt;
type Cid = S::Cid;
}
pub struct SetPublishedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPublishedAt<S> {}
impl<S: State> State for SetPublishedAt<S> {
type Publisher = S::Publisher;
type Uri = S::Uri;
type PublishedAt = Set<members::published_at>;
type Cid = S::Cid;
}
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 Publisher = S::Publisher;
type Uri = S::Uri;
type PublishedAt = S::PublishedAt;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct publisher(());
pub struct uri(());
pub struct published_at(());
pub struct cid(());
}
}
pub struct PublishedVersionViewBuilder<'a, S: published_version_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Cid<'a>>,
Option<StrongRef<'a>>,
Option<bool>,
Option<Datetime>,
Option<ProfileViewBasic<'a>>,
Option<Datetime>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PublishedVersionView<'a> {
pub fn new() -> PublishedVersionViewBuilder<
'a,
published_version_view_state::Empty,
> {
PublishedVersionViewBuilder::new()
}
}
impl<'a> PublishedVersionViewBuilder<'a, published_version_view_state::Empty> {
pub fn new() -> Self {
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PublishedVersionViewBuilder<'a, S>
where
S: published_version_view_state::State,
S::Cid: published_version_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetCid<S>> {
self._fields.0 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
pub fn diverged_from(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_diverged_from(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
pub fn is_canonical(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_is_canonical(mut self, value: Option<bool>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> PublishedVersionViewBuilder<'a, S>
where
S: published_version_view_state::State,
S::PublishedAt: published_version_view_state::IsUnset,
{
pub fn published_at(
mut self,
value: impl Into<Datetime>,
) -> PublishedVersionViewBuilder<
'a,
published_version_view_state::SetPublishedAt<S>,
> {
self._fields.3 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PublishedVersionViewBuilder<'a, S>
where
S: published_version_view_state::State,
S::Publisher: published_version_view_state::IsUnset,
{
pub fn publisher(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetPublisher<S>> {
self._fields.4 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: published_version_view_state::State> PublishedVersionViewBuilder<'a, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S> PublishedVersionViewBuilder<'a, S>
where
S: published_version_view_state::State,
S::Uri: published_version_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> PublishedVersionViewBuilder<'a, published_version_view_state::SetUri<S>> {
self._fields.6 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PublishedVersionViewBuilder<'a, S>
where
S: published_version_view_state::State,
S::Publisher: published_version_view_state::IsSet,
S::Uri: published_version_view_state::IsSet,
S::PublishedAt: published_version_view_state::IsSet,
S::Cid: published_version_view_state::IsSet,
{
pub fn build(self) -> PublishedVersionView<'a> {
PublishedVersionView {
cid: self._fields.0.unwrap(),
diverged_from: self._fields.1,
is_canonical: self._fields.2,
published_at: self._fields.3.unwrap(),
publisher: self._fields.4.unwrap(),
updated_at: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> PublishedVersionView<'a> {
PublishedVersionView {
cid: self._fields.0.unwrap(),
diverged_from: self._fields.1,
is_canonical: self._fields.2,
published_at: self._fields.3.unwrap(),
publisher: self._fields.4.unwrap(),
updated_at: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_bookmark_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 By;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type By = Unset;
type IndexedAt = Unset;
}
pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBy<S> {}
impl<S: State> State for SetBy<S> {
type By = Set<members::by>;
type IndexedAt = S::IndexedAt;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type By = S::By;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct by(());
pub struct indexed_at(());
}
}
pub struct ReasonBookmarkBuilder<'a, S: reason_bookmark_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ProfileViewBasic<'a>>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReasonBookmark<'a> {
pub fn new() -> ReasonBookmarkBuilder<'a, reason_bookmark_state::Empty> {
ReasonBookmarkBuilder::new()
}
}
impl<'a> ReasonBookmarkBuilder<'a, reason_bookmark_state::Empty> {
pub fn new() -> Self {
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonBookmarkBuilder<'a, S>
where
S: reason_bookmark_state::State,
S::By: reason_bookmark_state::IsUnset,
{
pub fn by(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> ReasonBookmarkBuilder<'a, reason_bookmark_state::SetBy<S>> {
self._fields.0 = Option::Some(value.into());
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonBookmarkBuilder<'a, S>
where
S: reason_bookmark_state::State,
S::IndexedAt: reason_bookmark_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonBookmarkBuilder<'a, reason_bookmark_state::SetIndexedAt<S>> {
self._fields.1 = Option::Some(value.into());
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonBookmarkBuilder<'a, S>
where
S: reason_bookmark_state::State,
S::By: reason_bookmark_state::IsSet,
S::IndexedAt: reason_bookmark_state::IsSet,
{
pub fn build(self) -> ReasonBookmark<'a> {
ReasonBookmark {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ReasonBookmark<'a> {
ReasonBookmark {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_like_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 IndexedAt;
type By;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type IndexedAt = Unset;
type By = Unset;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type IndexedAt = Set<members::indexed_at>;
type By = S::By;
}
pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBy<S> {}
impl<S: State> State for SetBy<S> {
type IndexedAt = S::IndexedAt;
type By = Set<members::by>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct indexed_at(());
pub struct by(());
}
}
pub struct ReasonLikeBuilder<'a, S: reason_like_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ProfileViewBasic<'a>>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReasonLike<'a> {
pub fn new() -> ReasonLikeBuilder<'a, reason_like_state::Empty> {
ReasonLikeBuilder::new()
}
}
impl<'a> ReasonLikeBuilder<'a, reason_like_state::Empty> {
pub fn new() -> Self {
ReasonLikeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonLikeBuilder<'a, S>
where
S: reason_like_state::State,
S::By: reason_like_state::IsUnset,
{
pub fn by(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> ReasonLikeBuilder<'a, reason_like_state::SetBy<S>> {
self._fields.0 = Option::Some(value.into());
ReasonLikeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonLikeBuilder<'a, S>
where
S: reason_like_state::State,
S::IndexedAt: reason_like_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonLikeBuilder<'a, reason_like_state::SetIndexedAt<S>> {
self._fields.1 = Option::Some(value.into());
ReasonLikeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonLikeBuilder<'a, S>
where
S: reason_like_state::State,
S::IndexedAt: reason_like_state::IsSet,
S::By: reason_like_state::IsSet,
{
pub fn build(self) -> ReasonLike<'a> {
ReasonLike {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ReasonLike<'a> {
ReasonLike {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_subscription_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 IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type IndexedAt = Unset;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct indexed_at(());
}
}
pub struct ReasonSubscriptionBuilder<'a, S: reason_subscription_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReasonSubscription<'a> {
pub fn new() -> ReasonSubscriptionBuilder<'a, reason_subscription_state::Empty> {
ReasonSubscriptionBuilder::new()
}
}
impl<'a> ReasonSubscriptionBuilder<'a, reason_subscription_state::Empty> {
pub fn new() -> Self {
ReasonSubscriptionBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonSubscriptionBuilder<'a, S>
where
S: reason_subscription_state::State,
S::IndexedAt: reason_subscription_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonSubscriptionBuilder<'a, reason_subscription_state::SetIndexedAt<S>> {
self._fields.0 = Option::Some(value.into());
ReasonSubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReasonSubscriptionBuilder<'a, S>
where
S: reason_subscription_state::State,
S::IndexedAt: reason_subscription_state::IsSet,
{
pub fn build(self) -> ReasonSubscription<'a> {
ReasonSubscription {
indexed_at: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ReasonSubscription<'a> {
ReasonSubscription {
indexed_at: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod rendered_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 Html;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Html = Unset;
}
pub struct SetHtml<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHtml<S> {}
impl<S: State> State for SetHtml<S> {
type Html = Set<members::html>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct html(());
}
}
pub struct RenderedViewBuilder<'a, S: rendered_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<BlobRef<'a>>, Option<BlobRef<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RenderedView<'a> {
pub fn new() -> RenderedViewBuilder<'a, rendered_view_state::Empty> {
RenderedViewBuilder::new()
}
}
impl<'a> RenderedViewBuilder<'a, rendered_view_state::Empty> {
pub fn new() -> Self {
RenderedViewBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: rendered_view_state::State> RenderedViewBuilder<'a, S> {
pub fn css(mut self, value: impl Into<Option<BlobRef<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_css(mut self, value: Option<BlobRef<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> RenderedViewBuilder<'a, S>
where
S: rendered_view_state::State,
S::Html: rendered_view_state::IsUnset,
{
pub fn html(
mut self,
value: impl Into<BlobRef<'a>>,
) -> RenderedViewBuilder<'a, rendered_view_state::SetHtml<S>> {
self._fields.1 = Option::Some(value.into());
RenderedViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RenderedViewBuilder<'a, S>
where
S: rendered_view_state::State,
S::Html: rendered_view_state::IsSet,
{
pub fn build(self) -> RenderedView<'a> {
RenderedView {
css: self._fields.0,
html: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> RenderedView<'a> {
RenderedView {
css: self._fields.0,
html: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}