From f2a8d51630cf21cd812a57dfd043bd4b209198d1 Mon Sep 17 00:00:00 2001 From: Orual Date: Thu, 8 Jan 2026 12:41:47 -0500 Subject: [PATCH] deckbelcher api types, some config stuff --- crates/weaver-api/Cargo.toml | 15 +- .../com_deckbelcher_actor_profile.json | 50 + .../lexicons/com_deckbelcher_deck_list.json | 106 + .../com_deckbelcher_richtext_facet.json | 89 + .../lexicons/com_deckbelcher_social_like.json | 30 + crates/weaver-api/src/app_bsky/actor.rs | 1330 ++++++++-- .../weaver-api/src/app_bsky/actor/profile.rs | 6 +- .../weaver-api/src/app_bsky/actor/status.rs | 122 +- .../weaver-api/src/app_bsky/ageassurance.rs | 526 ++-- .../src/app_bsky/ageassurance/begin.rs | 4 +- crates/weaver-api/src/app_bsky/bookmark.rs | 36 +- .../src/app_bsky/bookmark/create_bookmark.rs | 30 +- .../src/app_bsky/bookmark/delete_bookmark.rs | 4 +- crates/weaver-api/src/app_bsky/embed.rs | 32 +- .../weaver-api/src/app_bsky/embed/external.rs | 78 +- .../weaver-api/src/app_bsky/embed/images.rs | 74 +- .../weaver-api/src/app_bsky/embed/record.rs | 196 +- .../src/app_bsky/embed/record_with_media.rs | 36 +- crates/weaver-api/src/app_bsky/embed/video.rs | 40 +- crates/weaver-api/src/app_bsky/feed.rs | 540 ++-- .../app_bsky/feed/describe_feed_generator.rs | 10 +- .../weaver-api/src/app_bsky/feed/generator.rs | 138 +- .../src/app_bsky/feed/get_actor_likes.rs | 4 +- .../src/app_bsky/feed/get_author_feed.rs | 4 +- .../weaver-api/src/app_bsky/feed/get_feed.rs | 4 +- .../src/app_bsky/feed/get_feed_skeleton.rs | 4 +- .../weaver-api/src/app_bsky/feed/get_likes.rs | 38 +- .../src/app_bsky/feed/get_list_feed.rs | 4 +- .../src/app_bsky/feed/get_post_thread.rs | 4 +- crates/weaver-api/src/app_bsky/feed/like.rs | 6 +- crates/weaver-api/src/app_bsky/feed/post.rs | 74 +- .../weaver-api/src/app_bsky/feed/postgate.rs | 10 +- crates/weaver-api/src/app_bsky/feed/repost.rs | 32 +- .../src/app_bsky/feed/search_posts.rs | 4 +- .../src/app_bsky/feed/threadgate.rs | 22 +- crates/weaver-api/src/app_bsky/graph.rs | 376 +-- crates/weaver-api/src/app_bsky/graph/block.rs | 32 +- .../weaver-api/src/app_bsky/graph/follow.rs | 32 +- .../graph/get_lists_with_membership.rs | 8 +- .../src/app_bsky/graph/get_relationships.rs | 4 +- .../get_starter_packs_with_membership.rs | 8 +- crates/weaver-api/src/app_bsky/graph/list.rs | 54 +- .../src/app_bsky/graph/listblock.rs | 6 +- .../weaver-api/src/app_bsky/graph/listitem.rs | 36 +- .../src/app_bsky/graph/starterpack.rs | 40 +- .../src/app_bsky/graph/verification.rs | 40 +- crates/weaver-api/src/app_bsky/labeler.rs | 114 +- .../src/app_bsky/labeler/service.rs | 32 +- .../weaver-api/src/app_bsky/notification.rs | 670 +++-- .../src/app_bsky/notification/declaration.rs | 112 +- .../notification/list_notifications.rs | 271 +- .../app_bsky/notification/register_push.rs | 135 +- .../app_bsky/notification/unregister_push.rs | 165 +- .../weaver-api/src/app_bsky/richtext/facet.rs | 74 +- crates/weaver-api/src/app_bsky/unspecced.rs | 733 ++++-- .../src/app_bsky/unspecced/get_config.rs | 32 +- .../unspecced/get_post_thread_other_v2.rs | 38 +- .../app_bsky/unspecced/get_post_thread_v2.rs | 38 +- .../unspecced/get_tagged_suggestions.rs | 134 +- .../app_bsky/unspecced/init_age_assurance.rs | 4 +- .../unspecced/search_actors_skeleton.rs | 4 +- .../unspecced/search_posts_skeleton.rs | 4 +- .../search_starter_packs_skeleton.rs | 4 +- crates/weaver-api/src/app_bsky/video.rs | 131 +- .../src/blog_pckt/block/blockquote.rs | 6 +- .../src/blog_pckt/block/bluesky_embed.rs | 6 +- .../src/blog_pckt/block/bullet_list.rs | 6 +- .../src/blog_pckt/block/code_block.rs | 6 +- .../src/blog_pckt/block/hard_break.rs | 6 +- .../weaver-api/src/blog_pckt/block/heading.rs | 6 +- .../src/blog_pckt/block/horizontal_rule.rs | 6 +- .../weaver-api/src/blog_pckt/block/iframe.rs | 6 +- .../weaver-api/src/blog_pckt/block/image.rs | 40 +- .../src/blog_pckt/block/list_item.rs | 6 +- .../weaver-api/src/blog_pckt/block/mention.rs | 6 +- .../src/blog_pckt/block/ordered_list.rs | 6 +- .../src/blog_pckt/block/paragraph.rs | 6 +- .../src/blog_pckt/block/task_item.rs | 6 +- .../src/blog_pckt/block/task_list.rs | 6 +- crates/weaver-api/src/blog_pckt/block/text.rs | 6 +- .../weaver-api/src/blog_pckt/block/website.rs | 6 +- crates/weaver-api/src/blog_pckt/blog.rs | 14 +- crates/weaver-api/src/blog_pckt/document.rs | 86 +- crates/weaver-api/src/blog_pckt/mark/bold.rs | 6 +- crates/weaver-api/src/blog_pckt/mark/code.rs | 6 +- .../weaver-api/src/blog_pckt/mark/italic.rs | 6 +- crates/weaver-api/src/blog_pckt/mark/link.rs | 10 +- .../weaver-api/src/blog_pckt/mark/strike.rs | 6 +- .../src/blog_pckt/mark/underline.rs | 6 +- crates/weaver-api/src/blog_pckt/post.rs | 40 +- .../weaver-api/src/blog_pckt/publication.rs | 6 +- .../src/blog_pckt/richtext/facet.rs | 76 +- crates/weaver-api/src/blog_pckt/theme.rs | 10 +- crates/weaver-api/src/chat_bsky/actor.rs | 6 +- .../src/chat_bsky/actor/declaration.rs | 107 +- crates/weaver-api/src/chat_bsky/convo.rs | 605 +++-- .../src/chat_bsky/convo/add_reaction.rs | 4 +- .../src/chat_bsky/convo/remove_reaction.rs | 4 +- .../src/chat_bsky/convo/send_message.rs | 26 +- .../src/chat_bsky/convo/send_message_batch.rs | 34 +- .../src/chat_bsky/convo/update_all_read.rs | 90 +- .../moderation/get_actor_metadata.rs | 42 +- crates/weaver-api/src/com_atproto/admin.rs | 52 +- .../src/com_atproto/admin/send_email.rs | 30 +- .../com_atproto/admin/update_account_email.rs | 26 +- .../admin/update_account_handle.rs | 26 +- crates/weaver-api/src/com_atproto/identity.rs | 6 +- .../com_atproto/identity/refresh_identity.rs | 4 +- .../src/com_atproto/identity/resolve_did.rs | 4 +- .../com_atproto/identity/resolve_handle.rs | 4 +- .../com_atproto/identity/resolve_identity.rs | 4 +- crates/weaver-api/src/com_atproto/label.rs | 508 +++- .../src/com_atproto/label/subscribe_labels.rs | 127 +- .../com_atproto/lexicon/resolve_lexicon.rs | 4 +- .../src/com_atproto/lexicon/schema.rs | 6 +- .../weaver-api/src/com_atproto/moderation.rs | 12 + .../com_atproto/moderation/create_report.rs | 8 +- crates/weaver-api/src/com_atproto/repo.rs | 32 +- .../src/com_atproto/repo/apply_writes.rs | 392 ++- .../src/com_atproto/repo/create_record.rs | 148 +- .../src/com_atproto/repo/delete_record.rs | 34 +- .../src/com_atproto/repo/get_record.rs | 34 +- .../com_atproto/repo/list_missing_blobs.rs | 8 +- .../src/com_atproto/repo/list_records.rs | 82 +- .../src/com_atproto/repo/put_record.rs | 152 +- .../src/com_atproto/repo/strong_ref.rs | 6 +- crates/weaver-api/src/com_atproto/server.rs | 128 +- .../src/com_atproto/server/confirm_email.rs | 4 +- .../src/com_atproto/server/create_account.rs | 4 +- .../com_atproto/server/create_app_password.rs | 42 +- .../com_atproto/server/create_invite_codes.rs | 34 +- .../src/com_atproto/server/create_session.rs | 104 +- .../src/com_atproto/server/delete_account.rs | 34 +- .../src/com_atproto/server/describe_server.rs | 10 +- .../server/get_account_invite_codes.rs | 4 +- .../com_atproto/server/get_service_auth.rs | 4 +- .../src/com_atproto/server/get_session.rs | 98 +- .../com_atproto/server/list_app_passwords.rs | 10 +- .../src/com_atproto/server/refresh_session.rs | 108 +- .../src/com_atproto/server/reset_password.rs | 4 +- .../src/com_atproto/server/update_email.rs | 4 +- crates/weaver-api/src/com_atproto/sync.rs | 6 + .../src/com_atproto/sync/get_blob.rs | 30 +- .../src/com_atproto/sync/get_blocks.rs | 30 +- .../src/com_atproto/sync/get_head.rs | 4 +- .../src/com_atproto/sync/get_host_status.rs | 4 +- .../src/com_atproto/sync/get_latest_commit.rs | 4 +- .../src/com_atproto/sync/get_record.rs | 52 +- .../src/com_atproto/sync/get_repo.rs | 4 +- .../src/com_atproto/sync/get_repo_status.rs | 121 +- .../src/com_atproto/sync/list_blobs.rs | 4 +- .../src/com_atproto/sync/list_hosts.rs | 8 +- .../src/com_atproto/sync/list_repos.rs | 158 +- .../sync/list_repos_by_collection.rs | 8 +- .../src/com_atproto/sync/request_crawl.rs | 4 +- .../src/com_atproto/sync/subscribe_repos.rs | 690 +++-- .../temp/check_handle_availability.rs | 20 +- .../src/com_atproto/temp/dereference_scope.rs | 4 +- crates/weaver-api/src/com_deckbelcher.rs | 9 + .../weaver-api/src/com_deckbelcher/actor.rs | 6 + .../src/com_deckbelcher/actor/profile.rs | 545 ++++ crates/weaver-api/src/com_deckbelcher/deck.rs | 6 + .../src/com_deckbelcher/deck/list.rs | 1124 ++++++++ .../src/com_deckbelcher/richtext.rs | 6 + .../src/com_deckbelcher/richtext/facet.rs | 962 +++++++ .../weaver-api/src/com_deckbelcher/social.rs | 6 + .../src/com_deckbelcher/social/like.rs | 317 +++ crates/weaver-api/src/com_whtwnd/blog.rs | 44 +- .../weaver-api/src/com_whtwnd/blog/entry.rs | 6 +- .../blog/get_entry_metadata_by_name.rs | 4 +- .../com_whtwnd/blog/notify_of_new_entry.rs | 4 +- crates/weaver-api/src/lib.rs | 4 + .../src/pub_leaflet/blocks/blockquote.rs | 6 +- .../src/pub_leaflet/blocks/bsky_post.rs | 6 +- .../src/pub_leaflet/blocks/button.rs | 6 +- .../weaver-api/src/pub_leaflet/blocks/code.rs | 6 +- .../src/pub_leaflet/blocks/header.rs | 6 +- .../src/pub_leaflet/blocks/horizontal_rule.rs | 6 +- .../src/pub_leaflet/blocks/iframe.rs | 6 +- .../src/pub_leaflet/blocks/image.rs | 62 +- .../weaver-api/src/pub_leaflet/blocks/math.rs | 6 +- .../weaver-api/src/pub_leaflet/blocks/page.rs | 6 +- .../weaver-api/src/pub_leaflet/blocks/poll.rs | 6 +- .../weaver-api/src/pub_leaflet/blocks/text.rs | 6 +- .../src/pub_leaflet/blocks/unordered_list.rs | 10 +- .../src/pub_leaflet/blocks/website.rs | 6 +- crates/weaver-api/src/pub_leaflet/comment.rs | 44 +- crates/weaver-api/src/pub_leaflet/document.rs | 36 +- .../src/pub_leaflet/graph/subscription.rs | 6 +- .../src/pub_leaflet/pages/canvas.rs | 102 +- .../src/pub_leaflet/pages/linear_document.rs | 130 +- .../src/pub_leaflet/poll/definition.rs | 36 +- .../weaver-api/src/pub_leaflet/poll/vote.rs | 32 +- .../weaver-api/src/pub_leaflet/publication.rs | 16 +- .../src/pub_leaflet/richtext/facet.rs | 50 +- .../src/pub_leaflet/theme/background_image.rs | 6 +- .../weaver-api/src/pub_leaflet/theme/color.rs | 74 +- crates/weaver-api/src/sh_weaver/actor.rs | 94 +- .../weaver-api/src/sh_weaver/actor/profile.rs | 6 +- crates/weaver-api/src/sh_weaver/collab.rs | 1101 ++++++-- .../weaver-api/src/sh_weaver/collab/accept.rs | 36 +- .../weaver-api/src/sh_weaver/collab/invite.rs | 12 +- .../src/sh_weaver/collab/session.rs | 36 +- crates/weaver-api/src/sh_weaver/edit.rs | 250 +- .../weaver-api/src/sh_weaver/edit/cursor.rs | 56 +- crates/weaver-api/src/sh_weaver/edit/diff.rs | 6 +- crates/weaver-api/src/sh_weaver/edit/draft.rs | 6 +- .../src/sh_weaver/edit/list_drafts.rs | 8 +- crates/weaver-api/src/sh_weaver/edit/root.rs | 6 +- crates/weaver-api/src/sh_weaver/embed.rs | 36 +- .../src/sh_weaver/embed/external.rs | 48 +- .../weaver-api/src/sh_weaver/embed/images.rs | 48 +- .../src/sh_weaver/embed/record_with_media.rs | 36 +- .../weaver-api/src/sh_weaver/embed/records.rs | 146 +- .../weaver-api/src/sh_weaver/embed/video.rs | 18 +- crates/weaver-api/src/sh_weaver/graph.rs | 282 +- .../src/sh_weaver/graph/bookmark.rs | 6 +- .../weaver-api/src/sh_weaver/graph/follow.rs | 32 +- .../src/sh_weaver/graph/follow_accept.rs | 32 +- .../src/sh_weaver/graph/follow_gate.rs | 6 +- .../src/sh_weaver/graph/get_list.rs | 4 +- crates/weaver-api/src/sh_weaver/graph/like.rs | 6 +- crates/weaver-api/src/sh_weaver/graph/list.rs | 42 +- .../src/sh_weaver/graph/listitem.rs | 6 +- .../src/sh_weaver/graph/subscribe.rs | 32 +- .../src/sh_weaver/graph/subscribe_accept.rs | 32 +- crates/weaver-api/src/sh_weaver/graph/tag.rs | 36 +- crates/weaver-api/src/sh_weaver/notebook.rs | 741 ++++-- .../src/sh_weaver/notebook/authors.rs | 10 +- .../weaver-api/src/sh_weaver/notebook/book.rs | 32 +- .../src/sh_weaver/notebook/chapter.rs | 6 +- .../src/sh_weaver/notebook/colour_scheme.rs | 40 +- .../src/sh_weaver/notebook/entry.rs | 44 +- .../src/sh_weaver/notebook/get_book_entry.rs | 4 +- .../src/sh_weaver/notebook/get_chapter.rs | 4 +- .../src/sh_weaver/notebook/get_entry.rs | 4 +- .../sh_weaver/notebook/get_entry_by_title.rs | 4 +- .../sh_weaver/notebook/get_entry_detail.rs | 4 +- .../sh_weaver/notebook/get_entry_notebooks.rs | 34 +- .../notebook/get_notebook_by_title.rs | 4 +- .../sh_weaver/notebook/get_notebook_detail.rs | 4 +- .../src/sh_weaver/notebook/get_page.rs | 4 +- .../sh_weaver/notebook/get_reading_history.rs | 8 +- .../notebook/get_suggested_notebooks.rs | 155 +- .../weaver-api/src/sh_weaver/notebook/page.rs | 36 +- .../src/sh_weaver/notebook/resolve_entry.rs | 34 +- .../sh_weaver/notebook/resolve_notebook.rs | 4 +- .../notebook/resolve_version_conflict.rs | 4 +- .../src/sh_weaver/notebook/theme.rs | 192 +- .../notebook/update_reading_progress.rs | 117 +- .../weaver-api/src/sh_weaver/notification.rs | 184 +- .../weaver-api/src/sh_weaver/publish/blob.rs | 32 +- .../weaver-api/src/site_standard/document.rs | 36 +- .../src/site_standard/publication.rs | 36 +- .../src/site_standard/theme/basic.rs | 66 +- .../src/site_standard/theme/color.rs | 66 +- .../src/tools_ozone/communication.rs | 116 +- .../communication/create_template.rs | 4 +- .../communication/update_template.rs | 4 +- .../hosting/get_account_history.rs | 58 +- .../weaver-api/src/tools_ozone/moderation.rs | 2289 ++++++++++++----- .../moderation/cancel_scheduled_actions.rs | 64 +- .../src/tools_ozone/moderation/emit_event.rs | 34 +- .../moderation/get_account_timeline.rs | 570 +++- .../src/tools_ozone/moderation/get_record.rs | 4 +- .../src/tools_ozone/moderation/get_repo.rs | 4 +- .../tools_ozone/moderation/schedule_action.rs | 80 +- crates/weaver-api/src/tools_ozone/report.rs | 6 + crates/weaver-api/src/tools_ozone/safelink.rs | 332 +-- .../src/tools_ozone/safelink/add_rule.rs | 68 +- .../src/tools_ozone/safelink/query_events.rs | 93 +- .../src/tools_ozone/safelink/query_rules.rs | 93 +- .../src/tools_ozone/safelink/remove_rule.rs | 30 +- .../src/tools_ozone/safelink/update_rule.rs | 38 +- .../src/tools_ozone/server/get_config.rs | 110 +- crates/weaver-api/src/tools_ozone/set.rs | 66 +- .../src/tools_ozone/set/delete_set.rs | 4 +- .../src/tools_ozone/set/delete_values.rs | 30 +- .../src/tools_ozone/set/get_values.rs | 4 +- crates/weaver-api/src/tools_ozone/setting.rs | 304 ++- .../src/tools_ozone/setting/remove_options.rs | 120 +- .../src/tools_ozone/setting/upsert_option.rs | 236 +- .../weaver-api/src/tools_ozone/signature.rs | 6 +- .../signature/find_related_accounts.rs | 8 +- crates/weaver-api/src/tools_ozone/team.rs | 110 +- .../src/tools_ozone/team/add_member.rs | 108 +- .../src/tools_ozone/team/delete_member.rs | 4 +- .../src/tools_ozone/team/update_member.rs | 113 +- .../src/tools_ozone/verification.rs | 110 +- .../verification/grant_verifications.rs | 12 +- .../verification/revoke_verifications.rs | 34 +- crates/weaver-editor-js/.gitignore | 1 + crates/weaver-index/src/endpoints/edit.rs | 11 +- lexicons.kdl | 6 +- 294 files changed, 18438 insertions(+), 6750 deletions(-) create mode 100644 crates/weaver-api/lexicons/com_deckbelcher_actor_profile.json create mode 100644 crates/weaver-api/lexicons/com_deckbelcher_deck_list.json create mode 100644 crates/weaver-api/lexicons/com_deckbelcher_richtext_facet.json create mode 100644 crates/weaver-api/lexicons/com_deckbelcher_social_like.json create mode 100644 crates/weaver-api/src/com_deckbelcher.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/actor.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/actor/profile.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/deck.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/deck/list.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/richtext.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/richtext/facet.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/social.rs create mode 100644 crates/weaver-api/src/com_deckbelcher/social/like.rs diff --git a/crates/weaver-api/Cargo.toml b/crates/weaver-api/Cargo.toml index bbee7a4..1e8b634 100644 --- a/crates/weaver-api/Cargo.toml +++ b/crates/weaver-api/Cargo.toml @@ -30,12 +30,13 @@ serde = ["bytes/serde", "dep:serde_ipld_dagcbor"] # --- generated --- # Generated namespace features -app_bsky = [] -blog_pckt = ["site_standard"] -chat_bsky = [] +app_bsky = ["com_atproto"] +blog_pckt = ["com_atproto", "site_standard"] +chat_bsky = ["app_bsky"] com_atproto = [] +com_deckbelcher = ["com_atproto"] com_whtwnd = [] -pub_leaflet = [] -sh_weaver = ["app_bsky"] -site_standard = [] -tools_ozone = ["chat_bsky", "com_atproto"] +pub_leaflet = ["com_atproto"] +sh_weaver = ["app_bsky", "com_atproto"] +site_standard = ["com_atproto"] +tools_ozone = ["app_bsky", "chat_bsky", "com_atproto"] diff --git a/crates/weaver-api/lexicons/com_deckbelcher_actor_profile.json b/crates/weaver-api/lexicons/com_deckbelcher_actor_profile.json new file mode 100644 index 0000000..cc80b9d --- /dev/null +++ b/crates/weaver-api/lexicons/com_deckbelcher_actor_profile.json @@ -0,0 +1,50 @@ +{ + "lexicon": 1, + "id": "com.deckbelcher.actor.profile", + "defs": { + "main": { + "type": "record", + "description": "A DeckBelcher user profile.", + "key": "literal:self", + "record": { + "type": "object", + "required": [ + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "Timestamp when the profile was created.", + "format": "datetime" + }, + "description": { + "type": "string", + "description": "Free-form profile description.", + "maxLength": 2560, + "maxGraphemes": 256 + }, + "descriptionFacets": { + "type": "array", + "description": "Annotations of text in the profile description (mentions, URLs, hashtags, etc).", + "items": { + "type": "ref", + "ref": "com.deckbelcher.richtext.facet" + } + }, + "displayName": { + "type": "string", + "description": "User's display name.", + "maxLength": 640, + "maxGraphemes": 64 + }, + "pronouns": { + "type": "string", + "description": "Free-form pronouns text.", + "maxLength": 200, + "maxGraphemes": 20 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/weaver-api/lexicons/com_deckbelcher_deck_list.json b/crates/weaver-api/lexicons/com_deckbelcher_deck_list.json new file mode 100644 index 0000000..0a0d44c --- /dev/null +++ b/crates/weaver-api/lexicons/com_deckbelcher_deck_list.json @@ -0,0 +1,106 @@ +{ + "lexicon": 1, + "id": "com.deckbelcher.deck.list", + "defs": { + "card": { + "type": "object", + "description": "A card entry in a decklist.", + "required": [ + "scryfallId", + "quantity", + "section" + ], + "properties": { + "quantity": { + "type": "integer", + "description": "Number of copies in the deck.", + "minimum": 1 + }, + "scryfallId": { + "type": "string", + "description": "Scryfall UUID for the specific printing." + }, + "section": { + "type": "string", + "description": "Which section of the deck this card belongs to. Extensible to support format-specific sections.", + "knownValues": [ + "mainboard", + "sideboard", + "maybeboard", + "commander" + ] + }, + "tags": { + "type": "array", + "description": "User annotations for this card in this deck (e.g., \"removal\", \"wincon\", \"ramp\").", + "items": { + "type": "string", + "description": "A tag annotation for a card.", + "maxLength": 640, + "maxGraphemes": 64 + }, + "maxLength": 128 + } + } + }, + "main": { + "type": "record", + "description": "A Magic: The Gathering decklist.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "name", + "cards", + "createdAt" + ], + "properties": { + "cards": { + "type": "array", + "description": "Array of cards in the decklist.", + "items": { + "type": "ref", + "ref": "#card" + } + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the decklist was created.", + "format": "datetime" + }, + "format": { + "type": "string", + "description": "Format of the deck (e.g., \"commander\", \"cube\", \"pauper\").", + "maxLength": 320, + "maxGraphemes": 32 + }, + "name": { + "type": "string", + "description": "Name of the decklist.", + "maxLength": 1280, + "maxGraphemes": 128 + }, + "primer": { + "type": "string", + "description": "Deck primer with strategy, combos, and card choices.", + "maxLength": 100000, + "maxGraphemes": 10000 + }, + "primerFacets": { + "type": "array", + "description": "Annotations of text in the primer (mentions, URLs, hashtags, card references, etc).", + "items": { + "type": "ref", + "ref": "com.deckbelcher.richtext.facet" + } + }, + "updatedAt": { + "type": "string", + "description": "Timestamp when the decklist was last updated.", + "format": "datetime" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/weaver-api/lexicons/com_deckbelcher_richtext_facet.json b/crates/weaver-api/lexicons/com_deckbelcher_richtext_facet.json new file mode 100644 index 0000000..5e10327 --- /dev/null +++ b/crates/weaver-api/lexicons/com_deckbelcher_richtext_facet.json @@ -0,0 +1,89 @@ +{ + "lexicon": 1, + "id": "com.deckbelcher.richtext.facet", + "defs": { + "byteSlice": { + "type": "object", + "description": "Specifies the sub-string range a facet feature applies to.\nStart index is inclusive, end index is exclusive.\nIndices are zero-indexed, counting bytes of the UTF-8 encoded text.", + "required": [ + "byteStart", + "byteEnd" + ], + "properties": { + "byteEnd": { + "type": "integer", + "minimum": 0 + }, + "byteStart": { + "type": "integer", + "minimum": 0 + } + } + }, + "link": { + "type": "object", + "description": "Facet feature for a URL.\nThe text URL may have been simplified or truncated, but the facet reference should be a complete URL.", + "required": [ + "uri" + ], + "properties": { + "uri": { + "type": "string", + "format": "uri" + } + } + }, + "main": { + "type": "object", + "description": "Annotation of a sub-string within rich text.\nExtends Bluesky's facet system to support DeckBelcher-specific features.", + "required": [ + "index", + "features" + ], + "properties": { + "features": { + "type": "array", + "items": { + "type": "union", + "refs": [ + "#mention", + "#link", + "#tag" + ] + } + }, + "index": { + "type": "ref", + "ref": "#byteSlice" + } + } + }, + "mention": { + "type": "object", + "description": "Facet feature for mention of another account.\nThe text is usually a handle, including an `@` prefix, but the facet reference is a DID.", + "required": [ + "did" + ], + "properties": { + "did": { + "type": "string", + "format": "did" + } + } + }, + "tag": { + "type": "object", + "description": "Facet feature for a hashtag.\nThe text usually includes a '#' prefix, but the facet reference should not.", + "required": [ + "tag" + ], + "properties": { + "tag": { + "type": "string", + "maxLength": 640, + "maxGraphemes": 64 + } + } + } + } +} \ No newline at end of file diff --git a/crates/weaver-api/lexicons/com_deckbelcher_social_like.json b/crates/weaver-api/lexicons/com_deckbelcher_social_like.json new file mode 100644 index 0000000..c263cc5 --- /dev/null +++ b/crates/weaver-api/lexicons/com_deckbelcher_social_like.json @@ -0,0 +1,30 @@ +{ + "lexicon": 1, + "id": "com.deckbelcher.social.like", + "defs": { + "main": { + "type": "record", + "description": "Record declaring a 'like' of a piece of content (decklist, reply, etc).", + "key": "tid", + "record": { + "type": "object", + "required": [ + "subject", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "Timestamp when the like was created.", + "format": "datetime" + }, + "subject": { + "type": "ref", + "description": "Reference to the content being liked.", + "ref": "com.atproto.repo.strongRef" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/actor.rs b/crates/weaver-api/src/app_bsky/actor.rs index 1f2b962..3b7351a 100644 --- a/crates/weaver-api/src/app_bsky/actor.rs +++ b/crates/weaver-api/src/app_bsky/actor.rs @@ -142,7 +142,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("adultContentPref"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -153,7 +153,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("enabled"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -180,7 +180,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("guide"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -212,7 +212,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "activeProgressGuide", @@ -285,7 +285,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("label"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -355,7 +355,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("feed"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -442,7 +442,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("items"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -483,7 +483,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("tags"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -529,7 +529,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("count"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -571,7 +571,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -605,7 +605,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("labelers"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -641,7 +641,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "actorTarget", @@ -767,7 +767,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("items"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -807,7 +807,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "completed", @@ -887,7 +887,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "birthDate", @@ -929,7 +929,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "postgateEmbeddingRules", @@ -1015,7 +1015,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "activitySubscription", @@ -1097,7 +1097,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "allowSubscriptions", @@ -1133,7 +1133,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "allowIncoming", @@ -1168,7 +1168,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "associated", @@ -1380,7 +1380,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "associated", @@ -1556,7 +1556,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "associated", @@ -1865,7 +1865,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1936,7 +1936,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("pinned"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -2008,7 +2008,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("items"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -2040,7 +2040,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("embed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -2123,7 +2123,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("sort"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -2159,7 +2159,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hideBadges", @@ -2192,7 +2192,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "trustedVerifierStatus", @@ -2278,7 +2278,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -2368,7 +2368,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "activitySubscription", @@ -2507,7 +2507,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AdultContentPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2542,7 +2542,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BskyAppProgressGuide<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.guide; #[allow(unused_comparisons)] @@ -2601,7 +2601,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BskyAppStatePref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.nuxs { #[allow(unused_comparisons)] if value.len() > 100usize { @@ -2650,7 +2650,107 @@ pub struct ContentLabelPref<'a> { #[serde(borrow)] pub labeler_did: std::option::Option>, #[serde(borrow)] - pub visibility: jacquard_common::CowStr<'a>, + pub visibility: ContentLabelPrefVisibility<'a>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ContentLabelPrefVisibility<'a> { + Ignore, + Show, + Warn, + Hide, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ContentLabelPrefVisibility<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Ignore => "ignore", + Self::Show => "show", + Self::Warn => "warn", + Self::Hide => "hide", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ContentLabelPrefVisibility<'a> { + fn from(s: &'a str) -> Self { + match s { + "ignore" => Self::Ignore, + "show" => Self::Show, + "warn" => Self::Warn, + "hide" => Self::Hide, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ContentLabelPrefVisibility<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "ignore" => Self::Ignore, + "show" => Self::Show, + "warn" => Self::Warn, + "hide" => Self::Hide, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ContentLabelPrefVisibility<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ContentLabelPrefVisibility<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ContentLabelPrefVisibility<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ContentLabelPrefVisibility<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ContentLabelPrefVisibility<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ContentLabelPrefVisibility<'_> { + type Output = ContentLabelPrefVisibility<'static>; + fn into_static(self) -> Self::Output { + match self { + ContentLabelPrefVisibility::Ignore => ContentLabelPrefVisibility::Ignore, + ContentLabelPrefVisibility::Show => ContentLabelPrefVisibility::Show, + ContentLabelPrefVisibility::Warn => ContentLabelPrefVisibility::Warn, + ContentLabelPrefVisibility::Hide => ContentLabelPrefVisibility::Hide, + ContentLabelPrefVisibility::Other(v) => { + ContentLabelPrefVisibility::Other(v.into_static()) + } + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContentLabelPref<'a> { @@ -2665,7 +2765,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContentLabelPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2715,7 +2815,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedViewPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2854,7 +2954,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HiddenPostsPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2991,7 +3091,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InterestsPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.tags; #[allow(unused_comparisons)] @@ -3179,7 +3279,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for KnownFollowers<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.followers; #[allow(unused_comparisons)] @@ -3343,7 +3443,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerPrefItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3481,7 +3581,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelersPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3502,7 +3602,7 @@ pub struct MutedWord<'a> { /// Groups of users to apply the muted word to. If undefined, applies to all users. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub actor_target: std::option::Option>, + pub actor_target: std::option::Option>, /// The date and time at which the muted word will expire and no longer be applied. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub expires_at: std::option::Option, @@ -3527,37 +3627,37 @@ pub mod muted_word_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Value; type Targets; + type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Value = Unset; type Targets = Unset; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { - type Value = Set; - type Targets = S::Targets; + type Value = Unset; } ///State transition - sets the `targets` field to Set pub struct SetTargets(PhantomData S>); impl sealed::Sealed for SetTargets {} impl State for SetTargets { - type Value = S::Value; type Targets = Set; + type Value = S::Value; + } + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Targets = S::Targets; + type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `targets` field pub struct targets(()); + ///Marker type for the `value` field + pub struct value(()); } } @@ -3565,7 +3665,7 @@ pub mod muted_word_state { pub struct MutedWordBuilder<'a, S: muted_word_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>>, @@ -3596,7 +3696,7 @@ impl<'a, S: muted_word_state::State> MutedWordBuilder<'a, S> { /// Set the `actorTarget` field (optional) pub fn actor_target( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self @@ -3604,7 +3704,7 @@ impl<'a, S: muted_word_state::State> MutedWordBuilder<'a, S> { /// Set the `actorTarget` field to an Option value (optional) pub fn maybe_actor_target( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self @@ -3684,8 +3784,8 @@ where impl<'a, S> MutedWordBuilder<'a, S> where S: muted_word_state::State, - S::Value: muted_word_state::IsSet, S::Targets: muted_word_state::IsSet, + S::Value: muted_word_state::IsSet, { /// Build the final struct pub fn build(self) -> MutedWord<'a> { @@ -3717,6 +3817,99 @@ where } } +/// Groups of users to apply the muted word to. If undefined, applies to all users. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum MutedWordActorTarget<'a> { + All, + ExcludeFollowing, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> MutedWordActorTarget<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::All => "all", + Self::ExcludeFollowing => "exclude-following", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for MutedWordActorTarget<'a> { + fn from(s: &'a str) -> Self { + match s { + "all" => Self::All, + "exclude-following" => Self::ExcludeFollowing, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for MutedWordActorTarget<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "all" => Self::All, + "exclude-following" => Self::ExcludeFollowing, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for MutedWordActorTarget<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for MutedWordActorTarget<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for MutedWordActorTarget<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for MutedWordActorTarget<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for MutedWordActorTarget<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for MutedWordActorTarget<'_> { + type Output = MutedWordActorTarget<'static>; + fn into_static(self) -> Self::Output { + match self { + MutedWordActorTarget::All => MutedWordActorTarget::All, + MutedWordActorTarget::ExcludeFollowing => { + MutedWordActorTarget::ExcludeFollowing + } + MutedWordActorTarget::Other(v) => { + MutedWordActorTarget::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MutedWord<'a> { fn nsid() -> &'static str { "app.bsky.actor.defs" @@ -3729,7 +3922,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MutedWord<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.value; #[allow(unused_comparisons)] @@ -3809,6 +4002,12 @@ impl<'a> AsRef for MutedWordTarget<'a> { } } +impl<'a> core::fmt::Display for MutedWordTarget<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for MutedWordTarget<'a> { fn serialize(&self, serializer: S) -> Result where @@ -3976,7 +4175,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MutedWordsPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4199,7 +4398,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Nux<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.data { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -4277,7 +4476,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PersonalDetailsPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4345,7 +4544,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PostInteractionSettingsPr } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.postgate_embedding_rules { #[allow(unused_comparisons)] if value.len() > 5usize { @@ -4463,7 +4662,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileAssociated<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4482,7 +4681,114 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileAssociated<'a> { #[serde(rename_all = "camelCase")] pub struct ProfileAssociatedActivitySubscription<'a> { #[serde(borrow)] - pub allow_subscriptions: jacquard_common::CowStr<'a>, + pub allow_subscriptions: ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + Followers, + Mutuals, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Followers => "followers", + Self::Mutuals => "mutuals", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn from(s: &'a str) -> Self { + match s { + "followers" => Self::Followers, + "mutuals" => Self::Mutuals, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "followers" => Self::Followers, + "mutuals" => Self::Mutuals, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display +for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize +for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> +for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic +for ProfileAssociatedActivitySubscriptionAllowSubscriptions<'_> { + type Output = ProfileAssociatedActivitySubscriptionAllowSubscriptions<'static>; + fn into_static(self) -> Self::Output { + match self { + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Followers => { + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Followers + } + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Mutuals => { + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Mutuals + } + ProfileAssociatedActivitySubscriptionAllowSubscriptions::None => { + ProfileAssociatedActivitySubscriptionAllowSubscriptions::None + } + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Other(v) => { + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Other( + v.into_static(), + ) + } + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema @@ -4498,7 +4804,7 @@ for ProfileAssociatedActivitySubscription<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4517,23 +4823,124 @@ for ProfileAssociatedActivitySubscription<'a> { #[serde(rename_all = "camelCase")] pub struct ProfileAssociatedChat<'a> { #[serde(borrow)] - pub allow_incoming: jacquard_common::CowStr<'a>, + pub allow_incoming: ProfileAssociatedChatAllowIncoming<'a>, } -impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileAssociatedChat<'a> { - fn nsid() -> &'static str { - "app.bsky.actor.defs" - } - fn def_name() -> &'static str { - "profileAssociatedChat" +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ProfileAssociatedChatAllowIncoming<'a> { + All, + None, + Following, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ProfileAssociatedChatAllowIncoming<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::All => "all", + Self::None => "none", + Self::Following => "following", + Self::Other(s) => s.as_ref(), + } } - fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { - lexicon_doc_app_bsky_actor_defs() +} + +impl<'a> From<&'a str> for ProfileAssociatedChatAllowIncoming<'a> { + fn from(s: &'a str) -> Self { + match s { + "all" => Self::All, + "none" => Self::None, + "following" => Self::Following, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } } - fn validate( - &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { - Ok(()) +} + +impl<'a> From for ProfileAssociatedChatAllowIncoming<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "all" => Self::All, + "none" => Self::None, + "following" => Self::Following, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ProfileAssociatedChatAllowIncoming<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ProfileAssociatedChatAllowIncoming<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ProfileAssociatedChatAllowIncoming<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ProfileAssociatedChatAllowIncoming<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ProfileAssociatedChatAllowIncoming<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ProfileAssociatedChatAllowIncoming<'_> { + type Output = ProfileAssociatedChatAllowIncoming<'static>; + fn into_static(self) -> Self::Output { + match self { + ProfileAssociatedChatAllowIncoming::All => { + ProfileAssociatedChatAllowIncoming::All + } + ProfileAssociatedChatAllowIncoming::None => { + ProfileAssociatedChatAllowIncoming::None + } + ProfileAssociatedChatAllowIncoming::Following => { + ProfileAssociatedChatAllowIncoming::Following + } + ProfileAssociatedChatAllowIncoming::Other(v) => { + ProfileAssociatedChatAllowIncoming::Other(v.into_static()) + } + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileAssociatedChat<'a> { + fn nsid() -> &'static str { + "app.bsky.actor.defs" + } + fn def_name() -> &'static str { + "profileAssociatedChat" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_bsky_actor_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) } } @@ -4600,37 +5007,37 @@ pub mod profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle(PhantomData S>); - impl sealed::Sealed for SetHandle {} - impl State for SetHandle { - type Handle = Set; - type Did = S::Did; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Handle = S::Handle; type Did = Set; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle(PhantomData S>); + impl sealed::Sealed for SetHandle {} + impl State for SetHandle { + type Did = S::Did; + type Handle = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -4955,8 +5362,8 @@ impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> { impl<'a, S> ProfileViewBuilder<'a, S> where S: profile_view_state::State, - S::Handle: profile_view_state::IsSet, S::Did: profile_view_state::IsSet, + S::Handle: profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileView<'a> { @@ -5018,7 +5425,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2560usize { @@ -5513,7 +5920,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileViewBasic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.display_name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 640usize { @@ -6194,7 +6601,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileViewDetailed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2560usize { @@ -6275,7 +6682,7 @@ pub struct SavedFeed<'a> { pub id: jacquard_common::CowStr<'a>, pub pinned: bool, #[serde(borrow)] - pub r#type: jacquard_common::CowStr<'a>, + pub r#type: SavedFeedType<'a>, #[serde(borrow)] pub value: jacquard_common::CowStr<'a>, } @@ -6290,67 +6697,67 @@ pub mod saved_feed_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Id; + type Type; type Pinned; type Value; - type Type; - type Id; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Id = Unset; + type Type = Unset; type Pinned = Unset; type Value = Unset; - type Type = Unset; - type Id = Unset; + } + ///State transition - sets the `id` field to Set + pub struct SetId(PhantomData S>); + impl sealed::Sealed for SetId {} + impl State for SetId { + type Id = Set; + type Type = S::Type; + type Pinned = S::Pinned; + type Value = S::Value; + } + ///State transition - sets the `type` field to Set + pub struct SetType(PhantomData S>); + impl sealed::Sealed for SetType {} + impl State for SetType { + type Id = S::Id; + type Type = Set; + type Pinned = S::Pinned; + type Value = S::Value; } ///State transition - sets the `pinned` field to Set pub struct SetPinned(PhantomData S>); impl sealed::Sealed for SetPinned {} impl State for SetPinned { + type Id = S::Id; + type Type = S::Type; type Pinned = Set; type Value = S::Value; - type Type = S::Type; - type Id = S::Id; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { - type Pinned = S::Pinned; - type Value = Set; - type Type = S::Type; - type Id = S::Id; - } - ///State transition - sets the `type` field to Set - pub struct SetType(PhantomData S>); - impl sealed::Sealed for SetType {} - impl State for SetType { - type Pinned = S::Pinned; - type Value = S::Value; - type Type = Set; type Id = S::Id; - } - ///State transition - sets the `id` field to Set - pub struct SetId(PhantomData S>); - impl sealed::Sealed for SetId {} - impl State for SetId { - type Pinned = S::Pinned; - type Value = S::Value; type Type = S::Type; - type Id = Set; + type Pinned = S::Pinned; + type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `type` field + pub struct r#type(()); ///Marker type for the `pinned` field pub struct pinned(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `type` field - pub struct r#type(()); - ///Marker type for the `id` field - pub struct id(()); } } @@ -6360,7 +6767,7 @@ pub struct SavedFeedBuilder<'a, S: saved_feed_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -6430,7 +6837,7 @@ where /// Set the `type` field (required) pub fn r#type( mut self, - value: impl Into>, + value: impl Into>, ) -> SavedFeedBuilder<'a, saved_feed_state::SetType> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); SavedFeedBuilder { @@ -6463,10 +6870,10 @@ where impl<'a, S> SavedFeedBuilder<'a, S> where S: saved_feed_state::State, + S::Id: saved_feed_state::IsSet, + S::Type: saved_feed_state::IsSet, S::Pinned: saved_feed_state::IsSet, S::Value: saved_feed_state::IsSet, - S::Type: saved_feed_state::IsSet, - S::Id: saved_feed_state::IsSet, { /// Build the final struct pub fn build(self) -> SavedFeed<'a> { @@ -6496,6 +6903,99 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SavedFeedType<'a> { + Feed, + List, + Timeline, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SavedFeedType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Feed => "feed", + Self::List => "list", + Self::Timeline => "timeline", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SavedFeedType<'a> { + fn from(s: &'a str) -> Self { + match s { + "feed" => Self::Feed, + "list" => Self::List, + "timeline" => Self::Timeline, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SavedFeedType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "feed" => Self::Feed, + "list" => Self::List, + "timeline" => Self::Timeline, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SavedFeedType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SavedFeedType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SavedFeedType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SavedFeedType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SavedFeedType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SavedFeedType<'_> { + type Output = SavedFeedType<'static>; + fn into_static(self) -> Self::Output { + match self { + SavedFeedType::Feed => SavedFeedType::Feed, + SavedFeedType::List => SavedFeedType::List, + SavedFeedType::Timeline => SavedFeedType::Timeline, + SavedFeedType::Other(v) => SavedFeedType::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SavedFeed<'a> { fn nsid() -> &'static str { "app.bsky.actor.defs" @@ -6508,7 +7008,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SavedFeed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6543,37 +7043,37 @@ pub mod saved_feeds_pref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Pinned; type Saved; + type Pinned; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Pinned = Unset; type Saved = Unset; - } - ///State transition - sets the `pinned` field to Set - pub struct SetPinned(PhantomData S>); - impl sealed::Sealed for SetPinned {} - impl State for SetPinned { - type Pinned = Set; - type Saved = S::Saved; + type Pinned = Unset; } ///State transition - sets the `saved` field to Set pub struct SetSaved(PhantomData S>); impl sealed::Sealed for SetSaved {} impl State for SetSaved { - type Pinned = S::Pinned; type Saved = Set; + type Pinned = S::Pinned; + } + ///State transition - sets the `pinned` field to Set + pub struct SetPinned(PhantomData S>); + impl sealed::Sealed for SetPinned {} + impl State for SetPinned { + type Saved = S::Saved; + type Pinned = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `pinned` field - pub struct pinned(()); ///Marker type for the `saved` field pub struct saved(()); + ///Marker type for the `pinned` field + pub struct pinned(()); } } @@ -6660,8 +7160,8 @@ impl<'a, S: saved_feeds_pref_state::State> SavedFeedsPrefBuilder<'a, S> { impl<'a, S> SavedFeedsPrefBuilder<'a, S> where S: saved_feeds_pref_state::State, - S::Pinned: saved_feeds_pref_state::IsSet, S::Saved: saved_feeds_pref_state::IsSet, + S::Pinned: saved_feeds_pref_state::IsSet, { /// Build the final struct pub fn build(self) -> SavedFeedsPref<'a> { @@ -6701,7 +7201,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SavedFeedsPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6839,7 +7339,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SavedFeedsPrefV2<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6870,7 +7370,7 @@ pub struct StatusView<'a> { pub record: jacquard_common::types::value::Data<'a>, /// The status for the account. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: StatusViewStatus<'a>, } pub mod status_view_state { @@ -6925,7 +7425,7 @@ pub struct StatusViewBuilder<'a, S: status_view_state::State> { ::core::option::Option, ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -7026,7 +7526,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> StatusViewBuilder<'a, status_view_state::SetStatus> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); StatusViewBuilder { @@ -7073,24 +7573,108 @@ where } } -impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StatusView<'a> { - fn nsid() -> &'static str { - "app.bsky.actor.defs" - } - fn def_name() -> &'static str { - "statusView" - } - fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { - lexicon_doc_app_bsky_actor_defs() - } - fn validate( - &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { - Ok(()) - } +/// The status for the account. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum StatusViewStatus<'a> { + Live, + Other(jacquard_common::CowStr<'a>), } -#[jacquard_derive::lexicon] +impl<'a> StatusViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Live => "app.bsky.actor.status#live", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for StatusViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "app.bsky.actor.status#live" => Self::Live, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for StatusViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "app.bsky.actor.status#live" => Self::Live, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for StatusViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for StatusViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for StatusViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for StatusViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for StatusViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for StatusViewStatus<'_> { + type Output = StatusViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + StatusViewStatus::Live => StatusViewStatus::Live, + StatusViewStatus::Other(v) => StatusViewStatus::Other(v.into_static()), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StatusView<'a> { + fn nsid() -> &'static str { + "app.bsky.actor.defs" + } + fn def_name() -> &'static str { + "statusView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_bsky_actor_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, @@ -7106,7 +7690,111 @@ pub struct ThreadViewPref<'a> { /// Sorting mode for threads. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub sort: std::option::Option>, + pub sort: std::option::Option>, +} + +/// Sorting mode for threads. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ThreadViewPrefSort<'a> { + Oldest, + Newest, + MostLikes, + Random, + Hotness, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ThreadViewPrefSort<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Oldest => "oldest", + Self::Newest => "newest", + Self::MostLikes => "most-likes", + Self::Random => "random", + Self::Hotness => "hotness", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ThreadViewPrefSort<'a> { + fn from(s: &'a str) -> Self { + match s { + "oldest" => Self::Oldest, + "newest" => Self::Newest, + "most-likes" => Self::MostLikes, + "random" => Self::Random, + "hotness" => Self::Hotness, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ThreadViewPrefSort<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "oldest" => Self::Oldest, + "newest" => Self::Newest, + "most-likes" => Self::MostLikes, + "random" => Self::Random, + "hotness" => Self::Hotness, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ThreadViewPrefSort<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ThreadViewPrefSort<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ThreadViewPrefSort<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ThreadViewPrefSort<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ThreadViewPrefSort<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ThreadViewPrefSort<'_> { + type Output = ThreadViewPrefSort<'static>; + fn into_static(self) -> Self::Output { + match self { + ThreadViewPrefSort::Oldest => ThreadViewPrefSort::Oldest, + ThreadViewPrefSort::Newest => ThreadViewPrefSort::Newest, + ThreadViewPrefSort::MostLikes => ThreadViewPrefSort::MostLikes, + ThreadViewPrefSort::Random => ThreadViewPrefSort::Random, + ThreadViewPrefSort::Hotness => ThreadViewPrefSort::Hotness, + ThreadViewPrefSort::Other(v) => ThreadViewPrefSort::Other(v.into_static()), + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadViewPref<'a> { @@ -7121,7 +7809,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadViewPref<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7157,7 +7845,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationPrefs<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7177,13 +7865,13 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationPrefs<'a> { pub struct VerificationState<'a> { /// The user's status as a trusted verifier. #[serde(borrow)] - pub trusted_verifier_status: jacquard_common::CowStr<'a>, + pub trusted_verifier_status: VerificationStateTrustedVerifierStatus<'a>, /// All verifications issued by trusted verifiers on behalf of this user. Verifications by untrusted verifiers are not included. #[serde(borrow)] pub verifications: Vec>, /// The user's status as a verified account. #[serde(borrow)] - pub verified_status: jacquard_common::CowStr<'a>, + pub verified_status: VerificationStateVerifiedStatus<'a>, } pub mod verification_state_state { @@ -7196,51 +7884,51 @@ pub mod verification_state_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type VerifiedStatus; - type TrustedVerifierStatus; type Verifications; + type TrustedVerifierStatus; + type VerifiedStatus; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type VerifiedStatus = Unset; - type TrustedVerifierStatus = Unset; type Verifications = Unset; + type TrustedVerifierStatus = Unset; + type VerifiedStatus = Unset; } - ///State transition - sets the `verified_status` field to Set - pub struct SetVerifiedStatus(PhantomData S>); - impl sealed::Sealed for SetVerifiedStatus {} - impl State for SetVerifiedStatus { - type VerifiedStatus = Set; + ///State transition - sets the `verifications` field to Set + pub struct SetVerifications(PhantomData S>); + impl sealed::Sealed for SetVerifications {} + impl State for SetVerifications { + type Verifications = Set; type TrustedVerifierStatus = S::TrustedVerifierStatus; - type Verifications = S::Verifications; + type VerifiedStatus = S::VerifiedStatus; } ///State transition - sets the `trusted_verifier_status` field to Set pub struct SetTrustedVerifierStatus(PhantomData S>); impl sealed::Sealed for SetTrustedVerifierStatus {} impl State for SetTrustedVerifierStatus { - type VerifiedStatus = S::VerifiedStatus; - type TrustedVerifierStatus = Set; type Verifications = S::Verifications; - } - ///State transition - sets the `verifications` field to Set - pub struct SetVerifications(PhantomData S>); - impl sealed::Sealed for SetVerifications {} - impl State for SetVerifications { + type TrustedVerifierStatus = Set; type VerifiedStatus = S::VerifiedStatus; + } + ///State transition - sets the `verified_status` field to Set + pub struct SetVerifiedStatus(PhantomData S>); + impl sealed::Sealed for SetVerifiedStatus {} + impl State for SetVerifiedStatus { + type Verifications = S::Verifications; type TrustedVerifierStatus = S::TrustedVerifierStatus; - type Verifications = Set; + type VerifiedStatus = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `verified_status` field - pub struct verified_status(()); - ///Marker type for the `trusted_verifier_status` field - pub struct trusted_verifier_status(()); ///Marker type for the `verifications` field pub struct verifications(()); + ///Marker type for the `trusted_verifier_status` field + pub struct trusted_verifier_status(()); + ///Marker type for the `verified_status` field + pub struct verified_status(()); } } @@ -7248,9 +7936,9 @@ pub mod verification_state_state { pub struct VerificationStateBuilder<'a, S: verification_state_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -7281,7 +7969,7 @@ where /// Set the `trustedVerifierStatus` field (required) pub fn trusted_verifier_status( mut self, - value: impl Into>, + value: impl Into>, ) -> VerificationStateBuilder< 'a, verification_state_state::SetTrustedVerifierStatus, @@ -7322,7 +8010,7 @@ where /// Set the `verifiedStatus` field (required) pub fn verified_status( mut self, - value: impl Into>, + value: impl Into>, ) -> VerificationStateBuilder<'a, verification_state_state::SetVerifiedStatus> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); VerificationStateBuilder { @@ -7336,9 +8024,9 @@ where impl<'a, S> VerificationStateBuilder<'a, S> where S: verification_state_state::State, - S::VerifiedStatus: verification_state_state::IsSet, - S::TrustedVerifierStatus: verification_state_state::IsSet, S::Verifications: verification_state_state::IsSet, + S::TrustedVerifierStatus: verification_state_state::IsSet, + S::VerifiedStatus: verification_state_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationState<'a> { @@ -7366,6 +8054,210 @@ where } } +/// The user's status as a trusted verifier. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum VerificationStateTrustedVerifierStatus<'a> { + Valid, + Invalid, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> VerificationStateTrustedVerifierStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Invalid => "invalid", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for VerificationStateTrustedVerifierStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "invalid" => Self::Invalid, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for VerificationStateTrustedVerifierStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "invalid" => Self::Invalid, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for VerificationStateTrustedVerifierStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for VerificationStateTrustedVerifierStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for VerificationStateTrustedVerifierStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for VerificationStateTrustedVerifierStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for VerificationStateTrustedVerifierStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for VerificationStateTrustedVerifierStatus<'_> { + type Output = VerificationStateTrustedVerifierStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + VerificationStateTrustedVerifierStatus::Valid => { + VerificationStateTrustedVerifierStatus::Valid + } + VerificationStateTrustedVerifierStatus::Invalid => { + VerificationStateTrustedVerifierStatus::Invalid + } + VerificationStateTrustedVerifierStatus::None => { + VerificationStateTrustedVerifierStatus::None + } + VerificationStateTrustedVerifierStatus::Other(v) => { + VerificationStateTrustedVerifierStatus::Other(v.into_static()) + } + } + } +} + +/// The user's status as a verified account. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum VerificationStateVerifiedStatus<'a> { + Valid, + Invalid, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> VerificationStateVerifiedStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Invalid => "invalid", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for VerificationStateVerifiedStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "invalid" => Self::Invalid, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for VerificationStateVerifiedStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "invalid" => Self::Invalid, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for VerificationStateVerifiedStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for VerificationStateVerifiedStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for VerificationStateVerifiedStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for VerificationStateVerifiedStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for VerificationStateVerifiedStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for VerificationStateVerifiedStatus<'_> { + type Output = VerificationStateVerifiedStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + VerificationStateVerifiedStatus::Valid => { + VerificationStateVerifiedStatus::Valid + } + VerificationStateVerifiedStatus::Invalid => { + VerificationStateVerifiedStatus::Invalid + } + VerificationStateVerifiedStatus::None => { + VerificationStateVerifiedStatus::None + } + VerificationStateVerifiedStatus::Other(v) => { + VerificationStateVerifiedStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationState<'a> { fn nsid() -> &'static str { "app.bsky.actor.defs" @@ -7378,7 +8270,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7420,8 +8312,8 @@ pub mod verification_view_state { pub trait State: sealed::Sealed { type Issuer; type CreatedAt; - type IsValid; type Uri; + type IsValid; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -7429,8 +8321,8 @@ pub mod verification_view_state { impl State for Empty { type Issuer = Unset; type CreatedAt = Unset; - type IsValid = Unset; type Uri = Unset; + type IsValid = Unset; } ///State transition - sets the `issuer` field to Set pub struct SetIssuer(PhantomData S>); @@ -7438,8 +8330,8 @@ pub mod verification_view_state { impl State for SetIssuer { type Issuer = Set; type CreatedAt = S::CreatedAt; - type IsValid = S::IsValid; type Uri = S::Uri; + type IsValid = S::IsValid; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); @@ -7447,17 +8339,8 @@ pub mod verification_view_state { impl State for SetCreatedAt { type Issuer = S::Issuer; type CreatedAt = Set; - type IsValid = S::IsValid; - type Uri = S::Uri; - } - ///State transition - sets the `is_valid` field to Set - pub struct SetIsValid(PhantomData S>); - impl sealed::Sealed for SetIsValid {} - impl State for SetIsValid { - type Issuer = S::Issuer; - type CreatedAt = S::CreatedAt; - type IsValid = Set; type Uri = S::Uri; + type IsValid = S::IsValid; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); @@ -7465,8 +8348,17 @@ pub mod verification_view_state { impl State for SetUri { type Issuer = S::Issuer; type CreatedAt = S::CreatedAt; - type IsValid = S::IsValid; type Uri = Set; + type IsValid = S::IsValid; + } + ///State transition - sets the `is_valid` field to Set + pub struct SetIsValid(PhantomData S>); + impl sealed::Sealed for SetIsValid {} + impl State for SetIsValid { + type Issuer = S::Issuer; + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type IsValid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -7475,10 +8367,10 @@ pub mod verification_view_state { pub struct issuer(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `is_valid` field - pub struct is_valid(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `is_valid` field + pub struct is_valid(()); } } @@ -7593,8 +8485,8 @@ where S: verification_view_state::State, S::Issuer: verification_view_state::IsSet, S::CreatedAt: verification_view_state::IsSet, - S::IsValid: verification_view_state::IsSet, S::Uri: verification_view_state::IsSet, + S::IsValid: verification_view_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationView<'a> { @@ -7636,7 +8528,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7698,7 +8590,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/actor/profile.rs b/crates/weaver-api/src/app_bsky/actor/profile.rs index 0b2299c..efe0dad 100644 --- a/crates/weaver-api/src/app_bsky/actor/profile.rs +++ b/crates/weaver-api/src/app_bsky/actor/profile.rs @@ -428,7 +428,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2560usize { @@ -532,7 +532,7 @@ fn lexicon_doc_app_bsky_actor_profile() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -548,7 +548,7 @@ fn lexicon_doc_app_bsky_actor_profile() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { diff --git a/crates/weaver-api/src/app_bsky/actor/status.rs b/crates/weaver-api/src/app_bsky/actor/status.rs index 1d27df6..a58d3e2 100644 --- a/crates/weaver-api/src/app_bsky/actor/status.rs +++ b/crates/weaver-api/src/app_bsky/actor/status.rs @@ -46,7 +46,7 @@ pub struct Status<'a> { pub embed: std::option::Option>, /// The status for the account. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: StatusStatus<'a>, } pub mod status_state { @@ -59,37 +59,37 @@ pub mod status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type CreatedAt; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus(PhantomData S>); - impl sealed::Sealed for SetStatus {} - impl State for SetStatus { - type Status = Set; - type CreatedAt = S::CreatedAt; + type Status = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Status = S::Status; type CreatedAt = Set; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus(PhantomData S>); + impl sealed::Sealed for SetStatus {} + impl State for SetStatus { + type CreatedAt = S::CreatedAt; + type Status = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -100,7 +100,7 @@ pub struct StatusBuilder<'a, S: status_state::State> { ::core::option::Option, ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -182,7 +182,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> StatusBuilder<'a, status_state::SetStatus> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); StatusBuilder { @@ -196,8 +196,8 @@ where impl<'a, S> StatusBuilder<'a, S> where S: status_state::State, - S::Status: status_state::IsSet, S::CreatedAt: status_state::IsSet, + S::Status: status_state::IsSet, { /// Build the final struct pub fn build(self) -> Status<'a> { @@ -240,6 +240,90 @@ impl<'a> Status<'a> { } } +/// The status for the account. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum StatusStatus<'a> { + Live, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> StatusStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Live => "app.bsky.actor.status#live", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for StatusStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "app.bsky.actor.status#live" => Self::Live, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for StatusStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "app.bsky.actor.status#live" => Self::Live, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for StatusStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for StatusStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for StatusStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for StatusStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for StatusStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for StatusStatus<'_> { + type Output = StatusStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + StatusStatus::Live => StatusStatus::Live, + StatusStatus::Other(v) => StatusStatus::Other(v.into_static()), + } + } +} + /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, @@ -300,7 +384,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Status<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.duration_minutes { if *value < 1i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { @@ -325,7 +409,7 @@ fn lexicon_doc_app_bsky_actor_status() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("live"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { @@ -352,7 +436,7 @@ fn lexicon_doc_app_bsky_actor_status() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/ageassurance.rs b/crates/weaver-api/src/app_bsky/ageassurance.rs index 0eba9e3..47926de 100644 --- a/crates/weaver-api/src/app_bsky/ageassurance.rs +++ b/crates/weaver-api/src/app_bsky/ageassurance.rs @@ -61,6 +61,12 @@ impl<'a> AsRef for Access<'a> { } } +impl<'a> core::fmt::Display for Access<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for Access<'a> { fn serialize(&self, serializer: S) -> Result where @@ -228,7 +234,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { @@ -258,7 +264,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("regions"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -298,7 +304,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "countryCode", @@ -386,7 +392,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -419,7 +425,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -473,7 +479,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -527,7 +533,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -571,7 +577,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -615,7 +621,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -659,7 +665,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -704,7 +710,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -949,7 +955,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1007,7 +1013,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accountCreatedAt", @@ -1071,7 +1077,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Config<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1111,37 +1117,37 @@ pub mod config_region_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CountryCode; type Rules; + type CountryCode; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CountryCode = Unset; type Rules = Unset; - } - ///State transition - sets the `country_code` field to Set - pub struct SetCountryCode(PhantomData S>); - impl sealed::Sealed for SetCountryCode {} - impl State for SetCountryCode { - type CountryCode = Set; - type Rules = S::Rules; + type CountryCode = Unset; } ///State transition - sets the `rules` field to Set pub struct SetRules(PhantomData S>); impl sealed::Sealed for SetRules {} impl State for SetRules { - type CountryCode = S::CountryCode; type Rules = Set; + type CountryCode = S::CountryCode; + } + ///State transition - sets the `country_code` field to Set + pub struct SetCountryCode(PhantomData S>); + impl sealed::Sealed for SetCountryCode {} + impl State for SetCountryCode { + type Rules = S::Rules; + type CountryCode = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `country_code` field - pub struct country_code(()); ///Marker type for the `rules` field pub struct rules(()); + ///Marker type for the `country_code` field + pub struct country_code(()); } } @@ -1234,8 +1240,8 @@ where impl<'a, S> ConfigRegionBuilder<'a, S> where S: config_region_state::State, - S::CountryCode: config_region_state::IsSet, S::Rules: config_region_state::IsSet, + S::CountryCode: config_region_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegion<'a> { @@ -1318,7 +1324,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ConfigRegion<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1466,7 +1472,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ConfigRegionRuleDefault<' } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1500,37 +1506,37 @@ pub mod config_region_rule_if_account_newer_than_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Access; type Date; + type Access; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Access = Unset; type Date = Unset; - } - ///State transition - sets the `access` field to Set - pub struct SetAccess(PhantomData S>); - impl sealed::Sealed for SetAccess {} - impl State for SetAccess { - type Access = Set; - type Date = S::Date; + type Access = Unset; } ///State transition - sets the `date` field to Set pub struct SetDate(PhantomData S>); impl sealed::Sealed for SetDate {} impl State for SetDate { - type Access = S::Access; type Date = Set; + type Access = S::Access; + } + ///State transition - sets the `access` field to Set + pub struct SetAccess(PhantomData S>); + impl sealed::Sealed for SetAccess {} + impl State for SetAccess { + type Date = S::Date; + type Access = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `access` field - pub struct access(()); ///Marker type for the `date` field pub struct date(()); + ///Marker type for the `access` field + pub struct access(()); } } @@ -1620,8 +1626,8 @@ where impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S> where S: config_region_rule_if_account_newer_than_state::State, - S::Access: config_region_rule_if_account_newer_than_state::IsSet, S::Date: config_region_rule_if_account_newer_than_state::IsSet, + S::Access: config_region_rule_if_account_newer_than_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> { @@ -1660,7 +1666,7 @@ for ConfigRegionRuleIfAccountNewerThan<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1694,37 +1700,37 @@ pub mod config_region_rule_if_account_older_than_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Date; type Access; + type Date; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Date = Unset; type Access = Unset; - } - ///State transition - sets the `date` field to Set - pub struct SetDate(PhantomData S>); - impl sealed::Sealed for SetDate {} - impl State for SetDate { - type Date = Set; - type Access = S::Access; + type Date = Unset; } ///State transition - sets the `access` field to Set pub struct SetAccess(PhantomData S>); impl sealed::Sealed for SetAccess {} impl State for SetAccess { - type Date = S::Date; type Access = Set; + type Date = S::Date; + } + ///State transition - sets the `date` field to Set + pub struct SetDate(PhantomData S>); + impl sealed::Sealed for SetDate {} + impl State for SetDate { + type Access = S::Access; + type Date = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `date` field - pub struct date(()); ///Marker type for the `access` field pub struct access(()); + ///Marker type for the `date` field + pub struct date(()); } } @@ -1814,8 +1820,8 @@ where impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S> where S: config_region_rule_if_account_older_than_state::State, - S::Date: config_region_rule_if_account_older_than_state::IsSet, S::Access: config_region_rule_if_account_older_than_state::IsSet, + S::Date: config_region_rule_if_account_older_than_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> { @@ -1854,7 +1860,7 @@ for ConfigRegionRuleIfAccountOlderThan<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1888,37 +1894,37 @@ pub mod config_region_rule_if_assured_over_age_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Age; type Access; + type Age; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Age = Unset; type Access = Unset; - } - ///State transition - sets the `age` field to Set - pub struct SetAge(PhantomData S>); - impl sealed::Sealed for SetAge {} - impl State for SetAge { - type Age = Set; - type Access = S::Access; + type Age = Unset; } ///State transition - sets the `access` field to Set pub struct SetAccess(PhantomData S>); impl sealed::Sealed for SetAccess {} impl State for SetAccess { - type Age = S::Age; type Access = Set; + type Age = S::Age; + } + ///State transition - sets the `age` field to Set + pub struct SetAge(PhantomData S>); + impl sealed::Sealed for SetAge {} + impl State for SetAge { + type Access = S::Access; + type Age = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `age` field - pub struct age(()); ///Marker type for the `access` field pub struct access(()); + ///Marker type for the `age` field + pub struct age(()); } } @@ -2008,8 +2014,8 @@ where impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S> where S: config_region_rule_if_assured_over_age_state::State, - S::Age: config_region_rule_if_assured_over_age_state::IsSet, S::Access: config_region_rule_if_assured_over_age_state::IsSet, + S::Age: config_region_rule_if_assured_over_age_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> { @@ -2048,7 +2054,7 @@ for ConfigRegionRuleIfAssuredOverAge<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2082,37 +2088,37 @@ pub mod config_region_rule_if_assured_under_age_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Access; type Age; + type Access; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Access = Unset; type Age = Unset; - } - ///State transition - sets the `access` field to Set - pub struct SetAccess(PhantomData S>); - impl sealed::Sealed for SetAccess {} - impl State for SetAccess { - type Access = Set; - type Age = S::Age; + type Access = Unset; } ///State transition - sets the `age` field to Set pub struct SetAge(PhantomData S>); impl sealed::Sealed for SetAge {} impl State for SetAge { - type Access = S::Access; type Age = Set; + type Access = S::Access; + } + ///State transition - sets the `access` field to Set + pub struct SetAccess(PhantomData S>); + impl sealed::Sealed for SetAccess {} + impl State for SetAccess { + type Age = S::Age; + type Access = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `access` field - pub struct access(()); ///Marker type for the `age` field pub struct age(()); + ///Marker type for the `access` field + pub struct access(()); } } @@ -2202,8 +2208,8 @@ where impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S> where S: config_region_rule_if_assured_under_age_state::State, - S::Access: config_region_rule_if_assured_under_age_state::IsSet, S::Age: config_region_rule_if_assured_under_age_state::IsSet, + S::Access: config_region_rule_if_assured_under_age_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<'a> { @@ -2242,7 +2248,7 @@ for ConfigRegionRuleIfAssuredUnderAge<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2436,7 +2442,7 @@ for ConfigRegionRuleIfDeclaredOverAge<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2470,37 +2476,37 @@ pub mod config_region_rule_if_declared_under_age_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Age; type Access; + type Age; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Age = Unset; type Access = Unset; - } - ///State transition - sets the `age` field to Set - pub struct SetAge(PhantomData S>); - impl sealed::Sealed for SetAge {} - impl State for SetAge { - type Age = Set; - type Access = S::Access; + type Age = Unset; } ///State transition - sets the `access` field to Set pub struct SetAccess(PhantomData S>); impl sealed::Sealed for SetAccess {} impl State for SetAccess { - type Age = S::Age; type Access = Set; + type Age = S::Age; + } + ///State transition - sets the `age` field to Set + pub struct SetAge(PhantomData S>); + impl sealed::Sealed for SetAge {} + impl State for SetAge { + type Access = S::Access; + type Age = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `age` field - pub struct age(()); ///Marker type for the `access` field pub struct access(()); + ///Marker type for the `age` field + pub struct age(()); } } @@ -2590,8 +2596,8 @@ where impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S> where S: config_region_rule_if_declared_under_age_state::State, - S::Age: config_region_rule_if_declared_under_age_state::IsSet, S::Access: config_region_rule_if_declared_under_age_state::IsSet, + S::Age: config_region_rule_if_declared_under_age_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<'a> { @@ -2630,7 +2636,7 @@ for ConfigRegionRuleIfDeclaredUnderAge<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2650,7 +2656,7 @@ for ConfigRegionRuleIfDeclaredUnderAge<'a> { pub struct Event<'a> { /// The access level granted based on Age Assurance data we've processed. #[serde(borrow)] - pub access: jacquard_common::CowStr<'a>, + pub access: EventAccess<'a>, /// The unique identifier for this instance of the Age Assurance flow, in UUID format. #[serde(borrow)] pub attempt_id: jacquard_common::CowStr<'a>, @@ -2685,7 +2691,7 @@ pub struct Event<'a> { pub region_code: std::option::Option>, /// The status of the Age Assurance process. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: EventStatus<'a>, } pub mod event_state { @@ -2698,85 +2704,85 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Access; + type Status; type AttemptId; type CountryCode; type CreatedAt; - type Status; - type Access; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Access = Unset; + type Status = Unset; type AttemptId = Unset; type CountryCode = Unset; type CreatedAt = Unset; - type Status = Unset; - type Access = Unset; + } + ///State transition - sets the `access` field to Set + pub struct SetAccess(PhantomData S>); + impl sealed::Sealed for SetAccess {} + impl State for SetAccess { + type Access = Set; + type Status = S::Status; + type AttemptId = S::AttemptId; + type CountryCode = S::CountryCode; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus(PhantomData S>); + impl sealed::Sealed for SetStatus {} + impl State for SetStatus { + type Access = S::Access; + type Status = Set; + type AttemptId = S::AttemptId; + type CountryCode = S::CountryCode; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `attempt_id` field to Set pub struct SetAttemptId(PhantomData S>); impl sealed::Sealed for SetAttemptId {} impl State for SetAttemptId { + type Access = S::Access; + type Status = S::Status; type AttemptId = Set; type CountryCode = S::CountryCode; type CreatedAt = S::CreatedAt; - type Status = S::Status; - type Access = S::Access; } ///State transition - sets the `country_code` field to Set pub struct SetCountryCode(PhantomData S>); impl sealed::Sealed for SetCountryCode {} impl State for SetCountryCode { + type Access = S::Access; + type Status = S::Status; type AttemptId = S::AttemptId; type CountryCode = Set; type CreatedAt = S::CreatedAt; - type Status = S::Status; - type Access = S::Access; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type AttemptId = S::AttemptId; - type CountryCode = S::CountryCode; - type CreatedAt = Set; - type Status = S::Status; type Access = S::Access; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus(PhantomData S>); - impl sealed::Sealed for SetStatus {} - impl State for SetStatus { - type AttemptId = S::AttemptId; - type CountryCode = S::CountryCode; - type CreatedAt = S::CreatedAt; - type Status = Set; - type Access = S::Access; - } - ///State transition - sets the `access` field to Set - pub struct SetAccess(PhantomData S>); - impl sealed::Sealed for SetAccess {} - impl State for SetAccess { + type Status = S::Status; type AttemptId = S::AttemptId; type CountryCode = S::CountryCode; - type CreatedAt = S::CreatedAt; - type Status = S::Status; - type Access = Set; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `access` field + pub struct access(()); + ///Marker type for the `status` field + pub struct status(()); ///Marker type for the `attempt_id` field pub struct attempt_id(()); ///Marker type for the `country_code` field pub struct country_code(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `status` field - pub struct status(()); - ///Marker type for the `access` field - pub struct access(()); } } @@ -2784,7 +2790,7 @@ pub mod event_state { pub struct EventBuilder<'a, S: event_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, @@ -2794,7 +2800,7 @@ pub struct EventBuilder<'a, S: event_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -2837,7 +2843,7 @@ where /// Set the `access` field (required) pub fn access( mut self, - value: impl Into>, + value: impl Into>, ) -> EventBuilder<'a, event_state::SetAccess> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); EventBuilder { @@ -3018,7 +3024,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> EventBuilder<'a, event_state::SetStatus> { self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); EventBuilder { @@ -3032,11 +3038,11 @@ where impl<'a, S> EventBuilder<'a, S> where S: event_state::State, + S::Access: event_state::IsSet, + S::Status: event_state::IsSet, S::AttemptId: event_state::IsSet, S::CountryCode: event_state::IsSet, S::CreatedAt: event_state::IsSet, - S::Status: event_state::IsSet, - S::Access: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { @@ -3080,6 +3086,204 @@ where } } +/// The access level granted based on Age Assurance data we've processed. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum EventAccess<'a> { + Unknown, + None, + Safe, + Full, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> EventAccess<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::None => "none", + Self::Safe => "safe", + Self::Full => "full", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for EventAccess<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "none" => Self::None, + "safe" => Self::Safe, + "full" => Self::Full, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for EventAccess<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "none" => Self::None, + "safe" => Self::Safe, + "full" => Self::Full, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for EventAccess<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for EventAccess<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for EventAccess<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for EventAccess<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for EventAccess<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for EventAccess<'_> { + type Output = EventAccess<'static>; + fn into_static(self) -> Self::Output { + match self { + EventAccess::Unknown => EventAccess::Unknown, + EventAccess::None => EventAccess::None, + EventAccess::Safe => EventAccess::Safe, + EventAccess::Full => EventAccess::Full, + EventAccess::Other(v) => EventAccess::Other(v.into_static()), + } + } +} + +/// The status of the Age Assurance process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum EventStatus<'a> { + Unknown, + Pending, + Assured, + Blocked, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> EventStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::Pending => "pending", + Self::Assured => "assured", + Self::Blocked => "blocked", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for EventStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for EventStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for EventStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for EventStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for EventStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for EventStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for EventStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for EventStatus<'_> { + type Output = EventStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + EventStatus::Unknown => EventStatus::Unknown, + EventStatus::Pending => EventStatus::Pending, + EventStatus::Assured => EventStatus::Assured, + EventStatus::Blocked => EventStatus::Blocked, + EventStatus::Other(v) => EventStatus::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> { fn nsid() -> &'static str { "app.bsky.ageassurance.defs" @@ -3092,7 +3296,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3129,37 +3333,37 @@ pub mod state_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type Access; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type Access = Unset; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus(PhantomData S>); - impl sealed::Sealed for SetStatus {} - impl State for SetStatus { - type Status = Set; - type Access = S::Access; + type Status = Unset; } ///State transition - sets the `access` field to Set pub struct SetAccess(PhantomData S>); impl sealed::Sealed for SetAccess {} impl State for SetAccess { - type Status = S::Status; type Access = Set; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus(PhantomData S>); + impl sealed::Sealed for SetStatus {} + impl State for SetStatus { + type Access = S::Access; + type Status = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `access` field pub struct access(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -3252,8 +3456,8 @@ where impl<'a, S> StateBuilder<'a, S> where S: state_state::State, - S::Status: state_state::IsSet, S::Access: state_state::IsSet, + S::Status: state_state::IsSet, { /// Build the final struct pub fn build(self) -> State<'a> { @@ -3293,7 +3497,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for State<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3331,7 +3535,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StateMetadata<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3388,6 +3592,12 @@ impl<'a> AsRef for Status<'a> { } } +impl<'a> core::fmt::Display for Status<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for Status<'a> { fn serialize(&self, serializer: S) -> Result where diff --git a/crates/weaver-api/src/app_bsky/ageassurance/begin.rs b/crates/weaver-api/src/app_bsky/ageassurance/begin.rs index dfeebbc..f702cff 100644 --- a/crates/weaver-api/src/app_bsky/ageassurance/begin.rs +++ b/crates/weaver-api/src/app_bsky/ageassurance/begin.rs @@ -75,8 +75,8 @@ pub enum BeginError<'a> { RegionNotSupported(std::option::Option>), } -impl std::fmt::Display for BeginError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for BeginError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidEmail(msg) => { write!(f, "InvalidEmail")?; diff --git a/crates/weaver-api/src/app_bsky/bookmark.rs b/crates/weaver-api/src/app_bsky/bookmark.rs index 8d79fda..ac81a96 100644 --- a/crates/weaver-api/src/app_bsky/bookmark.rs +++ b/crates/weaver-api/src/app_bsky/bookmark.rs @@ -141,7 +141,7 @@ fn lexicon_doc_app_bsky_bookmark_defs() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("bookmark"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -156,7 +156,7 @@ fn lexicon_doc_app_bsky_bookmark_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -183,7 +183,7 @@ fn lexicon_doc_app_bsky_bookmark_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -245,7 +245,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bookmark<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -281,37 +281,37 @@ pub mod bookmark_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Item; type Subject; + type Item; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Item = Unset; type Subject = Unset; - } - ///State transition - sets the `item` field to Set - pub struct SetItem(PhantomData S>); - impl sealed::Sealed for SetItem {} - impl State for SetItem { - type Item = Set; - type Subject = S::Subject; + type Item = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type Item = S::Item; type Subject = Set; + type Item = S::Item; + } + ///State transition - sets the `item` field to Set + pub struct SetItem(PhantomData S>); + impl sealed::Sealed for SetItem {} + impl State for SetItem { + type Subject = S::Subject; + type Item = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `item` field - pub struct item(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `item` field + pub struct item(()); } } @@ -404,8 +404,8 @@ where impl<'a, S> BookmarkViewBuilder<'a, S> where S: bookmark_view_state::State, - S::Item: bookmark_view_state::IsSet, S::Subject: bookmark_view_state::IsSet, + S::Item: bookmark_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BookmarkView<'a> { @@ -466,7 +466,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookmarkView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/bookmark/create_bookmark.rs b/crates/weaver-api/src/app_bsky/bookmark/create_bookmark.rs index 306c5fd..6cdf6a4 100644 --- a/crates/weaver-api/src/app_bsky/bookmark/create_bookmark.rs +++ b/crates/weaver-api/src/app_bsky/bookmark/create_bookmark.rs @@ -33,37 +33,37 @@ pub mod create_bookmark_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> CreateBookmarkBuilder<'a, S> where S: create_bookmark_state::State, - S::Uri: create_bookmark_state::IsSet, S::Cid: create_bookmark_state::IsSet, + S::Uri: create_bookmark_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateBookmark<'a> { @@ -183,8 +183,8 @@ pub enum CreateBookmarkError<'a> { UnsupportedCollection(std::option::Option>), } -impl std::fmt::Display for CreateBookmarkError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateBookmarkError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::UnsupportedCollection(msg) => { write!(f, "UnsupportedCollection")?; diff --git a/crates/weaver-api/src/app_bsky/bookmark/delete_bookmark.rs b/crates/weaver-api/src/app_bsky/bookmark/delete_bookmark.rs index bd6d20a..7fcbe5f 100644 --- a/crates/weaver-api/src/app_bsky/bookmark/delete_bookmark.rs +++ b/crates/weaver-api/src/app_bsky/bookmark/delete_bookmark.rs @@ -146,8 +146,8 @@ pub enum DeleteBookmarkError<'a> { UnsupportedCollection(std::option::Option>), } -impl std::fmt::Display for DeleteBookmarkError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteBookmarkError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::UnsupportedCollection(msg) => { write!(f, "UnsupportedCollection")?; diff --git a/crates/weaver-api/src/app_bsky/embed.rs b/crates/weaver-api/src/app_bsky/embed.rs index edfa136..89519f1 100644 --- a/crates/weaver-api/src/app_bsky/embed.rs +++ b/crates/weaver-api/src/app_bsky/embed.rs @@ -38,37 +38,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Width; type Height; + type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Width = Unset; type Height = Unset; - } - ///State transition - sets the `width` field to Set - pub struct SetWidth(PhantomData S>); - impl sealed::Sealed for SetWidth {} - impl State for SetWidth { - type Width = Set; - type Height = S::Height; + type Width = Unset; } ///State transition - sets the `height` field to Set pub struct SetHeight(PhantomData S>); impl sealed::Sealed for SetHeight {} impl State for SetHeight { - type Width = S::Width; type Height = Set; + type Width = S::Width; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth(PhantomData S>); + impl sealed::Sealed for SetWidth {} + impl State for SetWidth { + type Height = S::Height; + type Width = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `width` field - pub struct width(()); ///Marker type for the `height` field pub struct height(()); + ///Marker type for the `width` field + pub struct width(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Width: aspect_ratio_state::IsSet, S::Height: aspect_ratio_state::IsSet, + S::Width: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { @@ -174,7 +174,7 @@ fn lexicon_doc_app_bsky_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -192,7 +192,7 @@ fn lexicon_doc_app_bsky_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -236,7 +236,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AspectRatio<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.height; if *value < 1i64 { diff --git a/crates/weaver-api/src/app_bsky/embed/external.rs b/crates/weaver-api/src/app_bsky/embed/external.rs index 1fe731c..a5bee9c 100644 --- a/crates/weaver-api/src/app_bsky/embed/external.rs +++ b/crates/weaver-api/src/app_bsky/embed/external.rs @@ -38,49 +38,49 @@ pub mod external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Title; + type Uri; type Description; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Title = Unset; + type Uri = Unset; type Description = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Title = S::Title; - type Description = S::Description; - } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { - type Uri = S::Uri; type Title = Set; + type Uri = S::Uri; + type Description = S::Description; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Title = S::Title; + type Uri = Set; type Description = S::Description; } ///State transition - sets the `description` field to Set pub struct SetDescription(PhantomData S>); impl sealed::Sealed for SetDescription {} impl State for SetDescription { - type Uri = S::Uri; type Title = S::Title; + type Uri = S::Uri; type Description = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `description` field pub struct description(()); } @@ -195,8 +195,8 @@ where impl<'a, S> ExternalBuilder<'a, S> where S: external_state::State, - S::Uri: external_state::IsSet, S::Title: external_state::IsSet, + S::Uri: external_state::IsSet, S::Description: external_state::IsSet, { /// Build the final struct @@ -236,7 +236,7 @@ fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("external"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -251,7 +251,7 @@ fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -329,7 +329,7 @@ fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("external"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -353,7 +353,7 @@ fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("external"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -381,7 +381,7 @@ fn lexicon_doc_app_bsky_embed_external() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -469,7 +469,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for External<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -608,7 +608,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ExternalRecord<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -746,7 +746,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -785,50 +785,50 @@ pub mod view_external_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Description; - type Title; type Uri; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Description = Unset; - type Title = Unset; type Uri = Unset; + type Title = Unset; } ///State transition - sets the `description` field to Set pub struct SetDescription(PhantomData S>); impl sealed::Sealed for SetDescription {} impl State for SetDescription { type Description = Set; - type Title = S::Title; - type Uri = S::Uri; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle(PhantomData S>); - impl sealed::Sealed for SetTitle {} - impl State for SetTitle { - type Description = S::Description; - type Title = Set; type Uri = S::Uri; + type Title = S::Title; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Description = S::Description; - type Title = S::Title; type Uri = Set; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle(PhantomData S>); + impl sealed::Sealed for SetTitle {} + impl State for SetTitle { + type Description = S::Description; + type Uri = S::Uri; + type Title = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `description` field pub struct description(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -942,8 +942,8 @@ impl<'a, S> ViewExternalBuilder<'a, S> where S: view_external_state::State, S::Description: view_external_state::IsSet, - S::Title: view_external_state::IsSet, S::Uri: view_external_state::IsSet, + S::Title: view_external_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewExternal<'a> { @@ -985,7 +985,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewExternal<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/embed/images.rs b/crates/weaver-api/src/app_bsky/embed/images.rs index 38edf27..fdb6bea 100644 --- a/crates/weaver-api/src/app_bsky/embed/images.rs +++ b/crates/weaver-api/src/app_bsky/embed/images.rs @@ -37,37 +37,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Image; type Alt; + type Image; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Image = Unset; type Alt = Unset; - } - ///State transition - sets the `image` field to Set - pub struct SetImage(PhantomData S>); - impl sealed::Sealed for SetImage {} - impl State for SetImage { - type Image = Set; - type Alt = S::Alt; + type Image = Unset; } ///State transition - sets the `alt` field to Set pub struct SetAlt(PhantomData S>); impl sealed::Sealed for SetAlt {} impl State for SetAlt { - type Image = S::Image; type Alt = Set; + type Image = S::Image; + } + ///State transition - sets the `image` field to Set + pub struct SetImage(PhantomData S>); + impl sealed::Sealed for SetImage {} + impl State for SetImage { + type Alt = S::Alt; + type Image = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `image` field - pub struct image(()); ///Marker type for the `alt` field pub struct alt(()); + ///Marker type for the `image` field + pub struct image(()); } } @@ -160,8 +160,8 @@ where impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Image: image_state::IsSet, S::Alt: image_state::IsSet, + S::Image: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { @@ -198,7 +198,7 @@ fn lexicon_doc_app_bsky_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -212,7 +212,7 @@ fn lexicon_doc_app_bsky_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -265,7 +265,7 @@ fn lexicon_doc_app_bsky_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -292,7 +292,7 @@ fn lexicon_doc_app_bsky_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -323,7 +323,7 @@ fn lexicon_doc_app_bsky_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -417,7 +417,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -555,7 +555,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Images<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] @@ -706,7 +706,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] @@ -760,51 +760,51 @@ pub mod view_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Fullsize; type Alt; type Thumb; - type Fullsize; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Fullsize = Unset; type Alt = Unset; type Thumb = Unset; - type Fullsize = Unset; + } + ///State transition - sets the `fullsize` field to Set + pub struct SetFullsize(PhantomData S>); + impl sealed::Sealed for SetFullsize {} + impl State for SetFullsize { + type Fullsize = Set; + type Alt = S::Alt; + type Thumb = S::Thumb; } ///State transition - sets the `alt` field to Set pub struct SetAlt(PhantomData S>); impl sealed::Sealed for SetAlt {} impl State for SetAlt { + type Fullsize = S::Fullsize; type Alt = Set; type Thumb = S::Thumb; - type Fullsize = S::Fullsize; } ///State transition - sets the `thumb` field to Set pub struct SetThumb(PhantomData S>); impl sealed::Sealed for SetThumb {} impl State for SetThumb { - type Alt = S::Alt; - type Thumb = Set; type Fullsize = S::Fullsize; - } - ///State transition - sets the `fullsize` field to Set - pub struct SetFullsize(PhantomData S>); - impl sealed::Sealed for SetFullsize {} - impl State for SetFullsize { type Alt = S::Alt; - type Thumb = S::Thumb; - type Fullsize = Set; + type Thumb = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `fullsize` field + pub struct fullsize(()); ///Marker type for the `alt` field pub struct alt(()); ///Marker type for the `thumb` field pub struct thumb(()); - ///Marker type for the `fullsize` field - pub struct fullsize(()); } } @@ -917,9 +917,9 @@ where impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, + S::Fullsize: view_image_state::IsSet, S::Alt: view_image_state::IsSet, S::Thumb: view_image_state::IsSet, - S::Fullsize: view_image_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewImage<'a> { @@ -961,7 +961,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewImage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/embed/record.rs b/crates/weaver-api/src/app_bsky/embed/record.rs index 439614d..336b4a2 100644 --- a/crates/weaver-api/src/app_bsky/embed/record.rs +++ b/crates/weaver-api/src/app_bsky/embed/record.rs @@ -135,7 +135,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -170,7 +170,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -206,7 +206,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -258,7 +258,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("detached"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -301,7 +301,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notFound"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -347,7 +347,7 @@ fn lexicon_doc_app_bsky_embed_record() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -522,7 +522,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Record<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -689,7 +689,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -723,49 +723,49 @@ pub mod view_blocked_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Author; + type Uri; type Blocked; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Author = Unset; + type Uri = Unset; type Blocked = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Author = S::Author; - type Blocked = S::Blocked; - } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type Uri = S::Uri; type Author = Set; + type Uri = S::Uri; + type Blocked = S::Blocked; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Author = S::Author; + type Uri = Set; type Blocked = S::Blocked; } ///State transition - sets the `blocked` field to Set pub struct SetBlocked(PhantomData S>); impl sealed::Sealed for SetBlocked {} impl State for SetBlocked { - type Uri = S::Uri; type Author = S::Author; + type Uri = S::Uri; type Blocked = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `blocked` field pub struct blocked(()); } @@ -860,8 +860,8 @@ where impl<'a, S> ViewBlockedBuilder<'a, S> where S: view_blocked_state::State, - S::Uri: view_blocked_state::IsSet, S::Author: view_blocked_state::IsSet, + S::Uri: view_blocked_state::IsSet, S::Blocked: view_blocked_state::IsSet, { /// Build the final struct @@ -902,7 +902,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewBlocked<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -934,37 +934,37 @@ pub mod view_detached_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Detached; type Uri; + type Detached; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Detached = Unset; type Uri = Unset; - } - ///State transition - sets the `detached` field to Set - pub struct SetDetached(PhantomData S>); - impl sealed::Sealed for SetDetached {} - impl State for SetDetached { - type Detached = Set; - type Uri = S::Uri; + type Detached = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Detached = S::Detached; type Uri = Set; + type Detached = S::Detached; + } + ///State transition - sets the `detached` field to Set + pub struct SetDetached(PhantomData S>); + impl sealed::Sealed for SetDetached {} + impl State for SetDetached { + type Uri = S::Uri; + type Detached = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `detached` field - pub struct detached(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `detached` field + pub struct detached(()); } } @@ -1037,8 +1037,8 @@ where impl<'a, S> ViewDetachedBuilder<'a, S> where S: view_detached_state::State, - S::Detached: view_detached_state::IsSet, S::Uri: view_detached_state::IsSet, + S::Detached: view_detached_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewDetached<'a> { @@ -1076,7 +1076,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewDetached<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1108,37 +1108,37 @@ pub mod view_not_found_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NotFound; type Uri; + type NotFound; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NotFound = Unset; type Uri = Unset; - } - ///State transition - sets the `not_found` field to Set - pub struct SetNotFound(PhantomData S>); - impl sealed::Sealed for SetNotFound {} - impl State for SetNotFound { - type NotFound = Set; - type Uri = S::Uri; + type NotFound = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type NotFound = S::NotFound; type Uri = Set; + type NotFound = S::NotFound; + } + ///State transition - sets the `not_found` field to Set + pub struct SetNotFound(PhantomData S>); + impl sealed::Sealed for SetNotFound {} + impl State for SetNotFound { + type Uri = S::Uri; + type NotFound = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `not_found` field - pub struct not_found(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `not_found` field + pub struct not_found(()); } } @@ -1211,8 +1211,8 @@ where impl<'a, S> ViewNotFoundBuilder<'a, S> where S: view_not_found_state::State, - S::NotFound: view_not_found_state::IsSet, S::Uri: view_not_found_state::IsSet, + S::NotFound: view_not_found_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewNotFound<'a> { @@ -1250,7 +1250,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewNotFound<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1303,85 +1303,85 @@ pub mod view_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type Author; - type IndexedAt; type Uri; + type Cid; type Value; + type IndexedAt; + type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type Author = Unset; - type IndexedAt = Unset; type Uri = Unset; + type Cid = Unset; type Value = Unset; + type IndexedAt = Unset; + type Author = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Uri = Set; + type Cid = S::Cid; + type Value = S::Value; + type IndexedAt = S::IndexedAt; + type Author = S::Author; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Cid = Set; - type Author = S::Author; - type IndexedAt = S::IndexedAt; type Uri = S::Uri; + type Cid = Set; type Value = S::Value; + type IndexedAt = S::IndexedAt; + type Author = S::Author; } - ///State transition - sets the `author` field to Set - pub struct SetAuthor(PhantomData S>); - impl sealed::Sealed for SetAuthor {} - impl State for SetAuthor { + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Uri = S::Uri; type Cid = S::Cid; - type Author = Set; + type Value = Set; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Value = S::Value; + type Author = S::Author; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Cid = S::Cid; - type Author = S::Author; - type IndexedAt = Set; type Uri = S::Uri; - type Value = S::Value; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { type Cid = S::Cid; - type Author = S::Author; - type IndexedAt = S::IndexedAt; - type Uri = Set; type Value = S::Value; + type IndexedAt = Set; + type Author = S::Author; } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { + ///State transition - sets the `author` field to Set + pub struct SetAuthor(PhantomData S>); + impl sealed::Sealed for SetAuthor {} + impl State for SetAuthor { + type Uri = S::Uri; type Cid = S::Cid; - type Author = S::Author; + type Value = S::Value; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Value = Set; + type Author = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `author` field - pub struct author(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `author` field + pub struct author(()); } } @@ -1619,11 +1619,11 @@ where impl<'a, S> ViewRecordBuilder<'a, S> where S: view_record_state::State, - S::Cid: view_record_state::IsSet, - S::Author: view_record_state::IsSet, - S::IndexedAt: view_record_state::IsSet, S::Uri: view_record_state::IsSet, + S::Cid: view_record_state::IsSet, S::Value: view_record_state::IsSet, + S::IndexedAt: view_record_state::IsSet, + S::Author: view_record_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewRecord<'a> { @@ -1704,7 +1704,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewRecord<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/embed/record_with_media.rs b/crates/weaver-api/src/app_bsky/embed/record_with_media.rs index e90e597..e530d9e 100644 --- a/crates/weaver-api/src/app_bsky/embed/record_with_media.rs +++ b/crates/weaver-api/src/app_bsky/embed/record_with_media.rs @@ -193,7 +193,7 @@ fn lexicon_doc_app_bsky_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -207,7 +207,7 @@ fn lexicon_doc_app_bsky_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("media"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -246,7 +246,7 @@ fn lexicon_doc_app_bsky_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("media"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -289,7 +289,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordWithMedia<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -322,37 +322,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Media; type Record; + type Media; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Media = Unset; type Record = Unset; - } - ///State transition - sets the `media` field to Set - pub struct SetMedia(PhantomData S>); - impl sealed::Sealed for SetMedia {} - impl State for SetMedia { - type Media = Set; - type Record = S::Record; + type Media = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Media = S::Media; type Record = Set; + type Media = S::Media; + } + ///State transition - sets the `media` field to Set + pub struct SetMedia(PhantomData S>); + impl sealed::Sealed for SetMedia {} + impl State for SetMedia { + type Record = S::Record; + type Media = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `media` field - pub struct media(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `media` field + pub struct media(()); } } @@ -425,8 +425,8 @@ where impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Media: view_state::IsSet, S::Record: view_state::IsSet, + S::Media: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { @@ -485,7 +485,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/embed/video.rs b/crates/weaver-api/src/app_bsky/embed/video.rs index bdb8d9d..03e866e 100644 --- a/crates/weaver-api/src/app_bsky/embed/video.rs +++ b/crates/weaver-api/src/app_bsky/embed/video.rs @@ -171,7 +171,7 @@ fn lexicon_doc_app_bsky_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("caption"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -185,7 +185,7 @@ fn lexicon_doc_app_bsky_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("file"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -225,7 +225,7 @@ fn lexicon_doc_app_bsky_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -293,7 +293,7 @@ fn lexicon_doc_app_bsky_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -394,7 +394,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Caption<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -603,7 +603,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Video<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.alt { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10000usize { @@ -687,37 +687,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Playlist; type Cid; + type Playlist; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Playlist = Unset; type Cid = Unset; - } - ///State transition - sets the `playlist` field to Set - pub struct SetPlaylist(PhantomData S>); - impl sealed::Sealed for SetPlaylist {} - impl State for SetPlaylist { - type Playlist = Set; - type Cid = S::Cid; + type Playlist = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Playlist = S::Playlist; type Cid = Set; + type Playlist = S::Playlist; + } + ///State transition - sets the `playlist` field to Set + pub struct SetPlaylist(PhantomData S>); + impl sealed::Sealed for SetPlaylist {} + impl State for SetPlaylist { + type Cid = S::Cid; + type Playlist = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `playlist` field - pub struct playlist(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `playlist` field + pub struct playlist(()); } } @@ -844,8 +844,8 @@ impl<'a, S: view_state::State> ViewBuilder<'a, S> { impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Playlist: view_state::IsSet, S::Cid: view_state::IsSet, + S::Playlist: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { @@ -889,7 +889,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.alt { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10000usize { diff --git a/crates/weaver-api/src/app_bsky/feed.rs b/crates/weaver-api/src/app_bsky/feed.rs index 49a685f..7ee404e 100644 --- a/crates/weaver-api/src/app_bsky/feed.rs +++ b/crates/weaver-api/src/app_bsky/feed.rs @@ -183,7 +183,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blockedAuthor"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -194,7 +194,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -239,7 +239,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -326,7 +326,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "feedContext", @@ -413,7 +413,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptsInteractions", @@ -635,7 +635,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("like"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -665,7 +665,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("event"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -791,7 +791,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notFound"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -837,7 +837,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1035,7 +1035,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -1053,7 +1053,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("by"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1133,7 +1133,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "grandparentAuthor", @@ -1195,7 +1195,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "feedContext", @@ -1257,7 +1257,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -1272,7 +1272,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("repost"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1306,7 +1306,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "rootAuthorLike", @@ -1340,7 +1340,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("parent"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -1400,7 +1400,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1471,7 +1471,7 @@ fn lexicon_doc_app_bsky_feed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "bookmarked", @@ -1575,7 +1575,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlockedAuthor<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1609,51 +1609,51 @@ pub mod blocked_post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Blocked; type Author; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Blocked = Unset; type Author = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Blocked = S::Blocked; - type Author = S::Author; + type Uri = Unset; } ///State transition - sets the `blocked` field to Set pub struct SetBlocked(PhantomData S>); impl sealed::Sealed for SetBlocked {} impl State for SetBlocked { - type Uri = S::Uri; type Blocked = Set; type Author = S::Author; + type Uri = S::Uri; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type Uri = S::Uri; type Blocked = S::Blocked; type Author = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Blocked = S::Blocked; + type Author = S::Author; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `blocked` field pub struct blocked(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -1746,9 +1746,9 @@ where impl<'a, S> BlockedPostBuilder<'a, S> where S: blocked_post_state::State, - S::Uri: blocked_post_state::IsSet, S::Blocked: blocked_post_state::IsSet, S::Author: blocked_post_state::IsSet, + S::Uri: blocked_post_state::IsSet, { /// Build the final struct pub fn build(self) -> BlockedPost<'a> { @@ -1788,7 +1788,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlockedPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2146,7 +2146,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedViewPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.feed_context { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2000usize { @@ -2196,7 +2196,7 @@ pub struct GeneratorView<'a> { pub cid: jacquard_common::types::string::Cid<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub content_mode: std::option::Option>, + pub content_mode: std::option::Option>, #[serde(borrow)] pub creator: crate::app_bsky::actor::ProfileView<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] @@ -2234,105 +2234,105 @@ pub mod generator_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IndexedAt; type Creator; - type DisplayName; - type Uri; type Cid; type Did; + type IndexedAt; + type Uri; + type DisplayName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IndexedAt = Unset; type Creator = Unset; - type DisplayName = Unset; - type Uri = Unset; type Cid = Unset; type Did = Unset; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type IndexedAt = Set; - type Creator = S::Creator; - type DisplayName = S::DisplayName; - type Uri = S::Uri; - type Cid = S::Cid; - type Did = S::Did; + type IndexedAt = Unset; + type Uri = Unset; + type DisplayName = Unset; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { - type IndexedAt = S::IndexedAt; type Creator = Set; - type DisplayName = S::DisplayName; - type Uri = S::Uri; type Cid = S::Cid; type Did = S::Did; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName(PhantomData S>); - impl sealed::Sealed for SetDisplayName {} - impl State for SetDisplayName { type IndexedAt = S::IndexedAt; - type Creator = S::Creator; - type DisplayName = Set; type Uri = S::Uri; - type Cid = S::Cid; - type Did = S::Did; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type IndexedAt = S::IndexedAt; - type Creator = S::Creator; type DisplayName = S::DisplayName; - type Uri = Set; - type Cid = S::Cid; - type Did = S::Did; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type IndexedAt = S::IndexedAt; type Creator = S::Creator; - type DisplayName = S::DisplayName; - type Uri = S::Uri; type Cid = Set; type Did = S::Did; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type DisplayName = S::DisplayName; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type IndexedAt = S::IndexedAt; type Creator = S::Creator; + type Cid = S::Cid; + type Did = Set; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; type DisplayName = S::DisplayName; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type Creator = S::Creator; + type Cid = S::Cid; + type Did = S::Did; + type IndexedAt = Set; type Uri = S::Uri; + type DisplayName = S::DisplayName; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Creator = S::Creator; type Cid = S::Cid; - type Did = Set; + type Did = S::Did; + type IndexedAt = S::IndexedAt; + type Uri = Set; + type DisplayName = S::DisplayName; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName(PhantomData S>); + impl sealed::Sealed for SetDisplayName {} + impl State for SetDisplayName { + type Creator = S::Creator; + type Cid = S::Cid; + type Did = S::Did; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type DisplayName = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `creator` field pub struct creator(()); - ///Marker type for the `display_name` field - pub struct display_name(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `display_name` field + pub struct display_name(()); } } @@ -2343,7 +2343,7 @@ pub struct GeneratorViewBuilder<'a, S: generator_view_state::State> { ::core::option::Option, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>>, @@ -2446,7 +2446,7 @@ impl<'a, S: generator_view_state::State> GeneratorViewBuilder<'a, S> { /// Set the `contentMode` field (optional) pub fn content_mode( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self @@ -2454,7 +2454,7 @@ impl<'a, S: generator_view_state::State> GeneratorViewBuilder<'a, S> { /// Set the `contentMode` field to an Option value (optional) pub fn maybe_content_mode( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self @@ -2648,12 +2648,12 @@ impl<'a, S: generator_view_state::State> GeneratorViewBuilder<'a, S> { impl<'a, S> GeneratorViewBuilder<'a, S> where S: generator_view_state::State, - S::IndexedAt: generator_view_state::IsSet, S::Creator: generator_view_state::IsSet, - S::DisplayName: generator_view_state::IsSet, - S::Uri: generator_view_state::IsSet, S::Cid: generator_view_state::IsSet, S::Did: generator_view_state::IsSet, + S::IndexedAt: generator_view_state::IsSet, + S::Uri: generator_view_state::IsSet, + S::DisplayName: generator_view_state::IsSet, { /// Build the final struct pub fn build(self) -> GeneratorView<'a> { @@ -2703,6 +2703,100 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GeneratorViewContentMode<'a> { + ContentModeUnspecified, + ContentModeVideo, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> GeneratorViewContentMode<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::ContentModeUnspecified => "app.bsky.feed.defs#contentModeUnspecified", + Self::ContentModeVideo => "app.bsky.feed.defs#contentModeVideo", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for GeneratorViewContentMode<'a> { + fn from(s: &'a str) -> Self { + match s { + "app.bsky.feed.defs#contentModeUnspecified" => Self::ContentModeUnspecified, + "app.bsky.feed.defs#contentModeVideo" => Self::ContentModeVideo, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for GeneratorViewContentMode<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "app.bsky.feed.defs#contentModeUnspecified" => Self::ContentModeUnspecified, + "app.bsky.feed.defs#contentModeVideo" => Self::ContentModeVideo, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for GeneratorViewContentMode<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for GeneratorViewContentMode<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for GeneratorViewContentMode<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for GeneratorViewContentMode<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for GeneratorViewContentMode<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for GeneratorViewContentMode<'_> { + type Output = GeneratorViewContentMode<'static>; + fn into_static(self) -> Self::Output { + match self { + GeneratorViewContentMode::ContentModeUnspecified => { + GeneratorViewContentMode::ContentModeUnspecified + } + GeneratorViewContentMode::ContentModeVideo => { + GeneratorViewContentMode::ContentModeVideo + } + GeneratorViewContentMode::Other(v) => { + GeneratorViewContentMode::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GeneratorView<'a> { fn nsid() -> &'static str { "app.bsky.feed.defs" @@ -2715,7 +2809,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GeneratorView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -2791,7 +2885,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GeneratorViewerState<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2811,7 +2905,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GeneratorViewerState<'a> pub struct Interaction<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub event: std::option::Option>, + pub event: std::option::Option>, /// Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] @@ -2825,6 +2919,146 @@ pub struct Interaction<'a> { pub req_id: std::option::Option>, } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum InteractionEvent<'a> { + RequestLess, + RequestMore, + ClickthroughItem, + ClickthroughAuthor, + ClickthroughReposter, + ClickthroughEmbed, + InteractionSeen, + InteractionLike, + InteractionRepost, + InteractionReply, + InteractionQuote, + InteractionShare, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> InteractionEvent<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RequestLess => "app.bsky.feed.defs#requestLess", + Self::RequestMore => "app.bsky.feed.defs#requestMore", + Self::ClickthroughItem => "app.bsky.feed.defs#clickthroughItem", + Self::ClickthroughAuthor => "app.bsky.feed.defs#clickthroughAuthor", + Self::ClickthroughReposter => "app.bsky.feed.defs#clickthroughReposter", + Self::ClickthroughEmbed => "app.bsky.feed.defs#clickthroughEmbed", + Self::InteractionSeen => "app.bsky.feed.defs#interactionSeen", + Self::InteractionLike => "app.bsky.feed.defs#interactionLike", + Self::InteractionRepost => "app.bsky.feed.defs#interactionRepost", + Self::InteractionReply => "app.bsky.feed.defs#interactionReply", + Self::InteractionQuote => "app.bsky.feed.defs#interactionQuote", + Self::InteractionShare => "app.bsky.feed.defs#interactionShare", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for InteractionEvent<'a> { + fn from(s: &'a str) -> Self { + match s { + "app.bsky.feed.defs#requestLess" => Self::RequestLess, + "app.bsky.feed.defs#requestMore" => Self::RequestMore, + "app.bsky.feed.defs#clickthroughItem" => Self::ClickthroughItem, + "app.bsky.feed.defs#clickthroughAuthor" => Self::ClickthroughAuthor, + "app.bsky.feed.defs#clickthroughReposter" => Self::ClickthroughReposter, + "app.bsky.feed.defs#clickthroughEmbed" => Self::ClickthroughEmbed, + "app.bsky.feed.defs#interactionSeen" => Self::InteractionSeen, + "app.bsky.feed.defs#interactionLike" => Self::InteractionLike, + "app.bsky.feed.defs#interactionRepost" => Self::InteractionRepost, + "app.bsky.feed.defs#interactionReply" => Self::InteractionReply, + "app.bsky.feed.defs#interactionQuote" => Self::InteractionQuote, + "app.bsky.feed.defs#interactionShare" => Self::InteractionShare, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for InteractionEvent<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "app.bsky.feed.defs#requestLess" => Self::RequestLess, + "app.bsky.feed.defs#requestMore" => Self::RequestMore, + "app.bsky.feed.defs#clickthroughItem" => Self::ClickthroughItem, + "app.bsky.feed.defs#clickthroughAuthor" => Self::ClickthroughAuthor, + "app.bsky.feed.defs#clickthroughReposter" => Self::ClickthroughReposter, + "app.bsky.feed.defs#clickthroughEmbed" => Self::ClickthroughEmbed, + "app.bsky.feed.defs#interactionSeen" => Self::InteractionSeen, + "app.bsky.feed.defs#interactionLike" => Self::InteractionLike, + "app.bsky.feed.defs#interactionRepost" => Self::InteractionRepost, + "app.bsky.feed.defs#interactionReply" => Self::InteractionReply, + "app.bsky.feed.defs#interactionQuote" => Self::InteractionQuote, + "app.bsky.feed.defs#interactionShare" => Self::InteractionShare, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for InteractionEvent<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for InteractionEvent<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for InteractionEvent<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for InteractionEvent<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for InteractionEvent<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for InteractionEvent<'_> { + type Output = InteractionEvent<'static>; + fn into_static(self) -> Self::Output { + match self { + InteractionEvent::RequestLess => InteractionEvent::RequestLess, + InteractionEvent::RequestMore => InteractionEvent::RequestMore, + InteractionEvent::ClickthroughItem => InteractionEvent::ClickthroughItem, + InteractionEvent::ClickthroughAuthor => InteractionEvent::ClickthroughAuthor, + InteractionEvent::ClickthroughReposter => { + InteractionEvent::ClickthroughReposter + } + InteractionEvent::ClickthroughEmbed => InteractionEvent::ClickthroughEmbed, + InteractionEvent::InteractionSeen => InteractionEvent::InteractionSeen, + InteractionEvent::InteractionLike => InteractionEvent::InteractionLike, + InteractionEvent::InteractionRepost => InteractionEvent::InteractionRepost, + InteractionEvent::InteractionReply => InteractionEvent::InteractionReply, + InteractionEvent::InteractionQuote => InteractionEvent::InteractionQuote, + InteractionEvent::InteractionShare => InteractionEvent::InteractionShare, + InteractionEvent::Other(v) => InteractionEvent::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Interaction<'a> { fn nsid() -> &'static str { "app.bsky.feed.defs" @@ -2837,7 +3071,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Interaction<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.feed_context { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2000usize { @@ -3143,7 +3377,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotFoundPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3207,85 +3441,85 @@ pub mod post_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Record; - type Uri; + type Cid; type Author; type IndexedAt; - type Cid; + type Uri; + type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Record = Unset; - type Uri = Unset; + type Cid = Unset; type Author = Unset; type IndexedAt = Unset; - type Cid = Unset; + type Uri = Unset; + type Record = Unset; } - ///State transition - sets the `record` field to Set - pub struct SetRecord(PhantomData S>); - impl sealed::Sealed for SetRecord {} - impl State for SetRecord { - type Record = Set; - type Uri = S::Uri; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Cid = Set; type Author = S::Author; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { + type Uri = S::Uri; type Record = S::Record; - type Uri = Set; - type Author = S::Author; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type Record = S::Record; - type Uri = S::Uri; + type Cid = S::Cid; type Author = Set; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; + type Uri = S::Uri; + type Record = S::Record; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Record = S::Record; - type Uri = S::Uri; + type Cid = S::Cid; type Author = S::Author; type IndexedAt = Set; - type Cid = S::Cid; + type Uri = S::Uri; + type Record = S::Record; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Author = S::Author; + type IndexedAt = S::IndexedAt; + type Uri = Set; type Record = S::Record; - type Uri = S::Uri; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData S>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { + type Cid = S::Cid; type Author = S::Author; type IndexedAt = S::IndexedAt; - type Cid = Set; + type Uri = S::Uri; + type Record = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `record` field - pub struct record(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `author` field pub struct author(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `cid` field - pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `record` field + pub struct record(()); } } @@ -3598,11 +3832,11 @@ impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { impl<'a, S> PostViewBuilder<'a, S> where S: post_view_state::State, - S::Record: post_view_state::IsSet, - S::Uri: post_view_state::IsSet, + S::Cid: post_view_state::IsSet, S::Author: post_view_state::IsSet, S::IndexedAt: post_view_state::IsSet, - S::Cid: post_view_state::IsSet, + S::Uri: post_view_state::IsSet, + S::Record: post_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PostView<'a> { @@ -3691,7 +3925,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PostView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3721,7 +3955,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReasonPin<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3945,7 +4179,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReasonRepost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4190,7 +4424,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4431,7 +4665,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonFeedPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.feed_context { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2000usize { @@ -4473,7 +4707,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonReasonPin<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4614,7 +4848,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonReasonRepost<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4650,7 +4884,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadContext<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4899,7 +5133,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadViewPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4943,7 +5177,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadgateView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4992,7 +5226,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/feed/describe_feed_generator.rs b/crates/weaver-api/src/app_bsky/feed/describe_feed_generator.rs index a6a60bc..20f6e8a 100644 --- a/crates/weaver-api/src/app_bsky/feed/describe_feed_generator.rs +++ b/crates/weaver-api/src/app_bsky/feed/describe_feed_generator.rs @@ -135,7 +135,7 @@ fn lexicon_doc_app_bsky_feed_describeFeedGenerator() -> ::jacquard_lexicon::lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("feed"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_app_bsky_feed_describeFeedGenerator() -> ::jacquard_lexicon::lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -176,7 +176,7 @@ fn lexicon_doc_app_bsky_feed_describeFeedGenerator() -> ::jacquard_lexicon::lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "privacyPolicy", @@ -241,7 +241,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Feed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -279,7 +279,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Links<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/app_bsky/feed/generator.rs b/crates/weaver-api/src/app_bsky/feed/generator.rs index 113990d..60b7b3d 100644 --- a/crates/weaver-api/src/app_bsky/feed/generator.rs +++ b/crates/weaver-api/src/app_bsky/feed/generator.rs @@ -26,7 +26,7 @@ pub struct Generator<'a> { pub avatar: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub content_mode: std::option::Option>, + pub content_mode: std::option::Option>, pub created_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] @@ -56,51 +56,51 @@ pub mod generator_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Did; type DisplayName; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Did = Unset; type DisplayName = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type CreatedAt = Set; + type Did = S::Did; + type DisplayName = S::DisplayName; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { + type CreatedAt = S::CreatedAt; type Did = Set; type DisplayName = S::DisplayName; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName(PhantomData S>); impl sealed::Sealed for SetDisplayName {} impl State for SetDisplayName { - type Did = S::Did; - type DisplayName = Set; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { type Did = S::Did; - type DisplayName = S::DisplayName; - type CreatedAt = Set; + type DisplayName = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `display_name` field pub struct display_name(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -110,7 +110,7 @@ pub struct GeneratorBuilder<'a, S: generator_state::State> { __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>>, @@ -185,7 +185,7 @@ impl<'a, S: generator_state::State> GeneratorBuilder<'a, S> { /// Set the `contentMode` field (optional) pub fn content_mode( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -193,7 +193,7 @@ impl<'a, S: generator_state::State> GeneratorBuilder<'a, S> { /// Set the `contentMode` field to an Option value (optional) pub fn maybe_content_mode( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -317,9 +317,9 @@ impl<'a, S: generator_state::State> GeneratorBuilder<'a, S> { impl<'a, S> GeneratorBuilder<'a, S> where S: generator_state::State, + S::CreatedAt: generator_state::IsSet, S::Did: generator_state::IsSet, S::DisplayName: generator_state::IsSet, - S::CreatedAt: generator_state::IsSet, { /// Build the final struct pub fn build(self) -> Generator<'a> { @@ -372,6 +372,100 @@ impl<'a> Generator<'a> { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GeneratorContentMode<'a> { + ContentModeUnspecified, + ContentModeVideo, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> GeneratorContentMode<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::ContentModeUnspecified => "app.bsky.feed.defs#contentModeUnspecified", + Self::ContentModeVideo => "app.bsky.feed.defs#contentModeVideo", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for GeneratorContentMode<'a> { + fn from(s: &'a str) -> Self { + match s { + "app.bsky.feed.defs#contentModeUnspecified" => Self::ContentModeUnspecified, + "app.bsky.feed.defs#contentModeVideo" => Self::ContentModeVideo, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for GeneratorContentMode<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "app.bsky.feed.defs#contentModeUnspecified" => Self::ContentModeUnspecified, + "app.bsky.feed.defs#contentModeVideo" => Self::ContentModeVideo, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for GeneratorContentMode<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for GeneratorContentMode<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for GeneratorContentMode<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for GeneratorContentMode<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for GeneratorContentMode<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for GeneratorContentMode<'_> { + type Output = GeneratorContentMode<'static>; + fn into_static(self) -> Self::Output { + match self { + GeneratorContentMode::ContentModeUnspecified => { + GeneratorContentMode::ContentModeUnspecified + } + GeneratorContentMode::ContentModeVideo => { + GeneratorContentMode::ContentModeVideo + } + GeneratorContentMode::Other(v) => { + GeneratorContentMode::Other(v.into_static()) + } + } + } +} + /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, @@ -432,7 +526,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Generator<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -508,7 +602,7 @@ fn lexicon_doc_app_bsky_feed_generator() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -530,7 +624,7 @@ fn lexicon_doc_app_bsky_feed_generator() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptsInteractions", diff --git a/crates/weaver-api/src/app_bsky/feed/get_actor_likes.rs b/crates/weaver-api/src/app_bsky/feed/get_actor_likes.rs index e79a069..3549eba 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_actor_likes.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_actor_likes.rs @@ -190,8 +190,8 @@ pub enum GetActorLikesError<'a> { BlockedByActor(std::option::Option>), } -impl std::fmt::Display for GetActorLikesError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetActorLikesError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BlockedActor(msg) => { write!(f, "BlockedActor")?; diff --git a/crates/weaver-api/src/app_bsky/feed/get_author_feed.rs b/crates/weaver-api/src/app_bsky/feed/get_author_feed.rs index 9cca794..fccc92a 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_author_feed.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_author_feed.rs @@ -230,8 +230,8 @@ pub enum GetAuthorFeedError<'a> { BlockedByActor(std::option::Option>), } -impl std::fmt::Display for GetAuthorFeedError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetAuthorFeedError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BlockedActor(msg) => { write!(f, "BlockedActor")?; diff --git a/crates/weaver-api/src/app_bsky/feed/get_feed.rs b/crates/weaver-api/src/app_bsky/feed/get_feed.rs index 26c2641..e48b696 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_feed.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_feed.rs @@ -188,8 +188,8 @@ pub enum GetFeedError<'a> { UnknownFeed(std::option::Option>), } -impl std::fmt::Display for GetFeedError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetFeedError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::UnknownFeed(msg) => { write!(f, "UnknownFeed")?; diff --git a/crates/weaver-api/src/app_bsky/feed/get_feed_skeleton.rs b/crates/weaver-api/src/app_bsky/feed/get_feed_skeleton.rs index 52618ed..553d778 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_feed_skeleton.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_feed_skeleton.rs @@ -192,8 +192,8 @@ pub enum GetFeedSkeletonError<'a> { UnknownFeed(std::option::Option>), } -impl std::fmt::Display for GetFeedSkeletonError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetFeedSkeletonError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::UnknownFeed(msg) => { write!(f, "UnknownFeed")?; diff --git a/crates/weaver-api/src/app_bsky/feed/get_likes.rs b/crates/weaver-api/src/app_bsky/feed/get_likes.rs index ddb9418..e5ae446 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_likes.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_likes.rs @@ -34,50 +34,50 @@ pub mod like_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; - type Actor; type IndexedAt; + type Actor; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; - type Actor = Unset; type IndexedAt = Unset; + type Actor = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type CreatedAt = Set; - type Actor = S::Actor; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `actor` field to Set - pub struct SetActor(PhantomData S>); - impl sealed::Sealed for SetActor {} - impl State for SetActor { - type CreatedAt = S::CreatedAt; - type Actor = Set; type IndexedAt = S::IndexedAt; + type Actor = S::Actor; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { type CreatedAt = S::CreatedAt; - type Actor = S::Actor; type IndexedAt = Set; + type Actor = S::Actor; + } + ///State transition - sets the `actor` field to Set + pub struct SetActor(PhantomData S>); + impl sealed::Sealed for SetActor {} + impl State for SetActor { + type CreatedAt = S::CreatedAt; + type IndexedAt = S::IndexedAt; + type Actor = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `actor` field - pub struct actor(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `actor` field + pub struct actor(()); } } @@ -171,8 +171,8 @@ impl<'a, S> LikeBuilder<'a, S> where S: like_state::State, S::CreatedAt: like_state::IsSet, - S::Actor: like_state::IsSet, S::IndexedAt: like_state::IsSet, + S::Actor: like_state::IsSet, { /// Build the final struct pub fn build(self) -> Like<'a> { @@ -209,7 +209,7 @@ fn lexicon_doc_app_bsky_feed_getLikes() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("like"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -224,7 +224,7 @@ fn lexicon_doc_app_bsky_feed_getLikes() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -290,7 +290,7 @@ fn lexicon_doc_app_bsky_feed_getLikes() -> ::jacquard_lexicon::lexicon::LexiconD ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -384,7 +384,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Like<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/app_bsky/feed/get_list_feed.rs b/crates/weaver-api/src/app_bsky/feed/get_list_feed.rs index 1ae2713..44b1839 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_list_feed.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_list_feed.rs @@ -188,8 +188,8 @@ pub enum GetListFeedError<'a> { UnknownList(std::option::Option>), } -impl std::fmt::Display for GetListFeedError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetListFeedError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::UnknownList(msg) => { write!(f, "UnknownList")?; diff --git a/crates/weaver-api/src/app_bsky/feed/get_post_thread.rs b/crates/weaver-api/src/app_bsky/feed/get_post_thread.rs index d0fea83..b8544a5 100644 --- a/crates/weaver-api/src/app_bsky/feed/get_post_thread.rs +++ b/crates/weaver-api/src/app_bsky/feed/get_post_thread.rs @@ -206,8 +206,8 @@ pub enum GetPostThreadError<'a> { NotFound(std::option::Option>), } -impl std::fmt::Display for GetPostThreadError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetPostThreadError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotFound(msg) => { write!(f, "NotFound")?; diff --git a/crates/weaver-api/src/app_bsky/feed/like.rs b/crates/weaver-api/src/app_bsky/feed/like.rs index 7d60480..a326a4b 100644 --- a/crates/weaver-api/src/app_bsky/feed/like.rs +++ b/crates/weaver-api/src/app_bsky/feed/like.rs @@ -261,7 +261,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Like<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -273,7 +273,7 @@ fn lexicon_doc_app_bsky_feed_like() -> ::jacquard_lexicon::lexicon::LexiconDoc<' revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -294,7 +294,7 @@ fn lexicon_doc_app_bsky_feed_like() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/feed/post.rs b/crates/weaver-api/src/app_bsky/feed/post.rs index a6c2726..0d3fa4e 100644 --- a/crates/weaver-api/src/app_bsky/feed/post.rs +++ b/crates/weaver-api/src/app_bsky/feed/post.rs @@ -37,51 +37,51 @@ pub mod entity_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Type; type Value; type Index; - type Type; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Type = Unset; type Value = Unset; type Index = Unset; - type Type = Unset; + } + ///State transition - sets the `type` field to Set + pub struct SetType(PhantomData S>); + impl sealed::Sealed for SetType {} + impl State for SetType { + type Type = Set; + type Value = S::Value; + type Index = S::Index; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { + type Type = S::Type; type Value = Set; type Index = S::Index; - type Type = S::Type; } ///State transition - sets the `index` field to Set pub struct SetIndex(PhantomData S>); impl sealed::Sealed for SetIndex {} impl State for SetIndex { - type Value = S::Value; - type Index = Set; type Type = S::Type; - } - ///State transition - sets the `type` field to Set - pub struct SetType(PhantomData S>); - impl sealed::Sealed for SetType {} - impl State for SetType { type Value = S::Value; - type Index = S::Index; - type Type = Set; + type Index = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `type` field + pub struct r#type(()); ///Marker type for the `value` field pub struct value(()); ///Marker type for the `index` field pub struct index(()); - ///Marker type for the `type` field - pub struct r#type(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> EntityBuilder<'a, S> where S: entity_state::State, + S::Type: entity_state::IsSet, S::Value: entity_state::IsSet, S::Index: entity_state::IsSet, - S::Type: entity_state::IsSet, { /// Build the final struct pub fn build(self) -> Entity<'a> { @@ -211,7 +211,7 @@ fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<' revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entity"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -230,7 +230,7 @@ fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("index"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -296,7 +296,7 @@ fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -478,7 +478,7 @@ fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("parent"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -518,7 +518,7 @@ fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<' nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("end"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -562,7 +562,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entity<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -622,37 +622,37 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Text; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Text = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; - type Text = S::Text; + type CreatedAt = Unset; } ///State transition - sets the `text` field to Set pub struct SetText(PhantomData S>); impl sealed::Sealed for SetText {} impl State for SetText { - type CreatedAt = S::CreatedAt; type Text = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Text = S::Text; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `text` field pub struct text(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -869,8 +869,8 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::CreatedAt: post_state::IsSet, S::Text: post_state::IsSet, + S::CreatedAt: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { @@ -1008,7 +1008,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Post<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.langs { #[allow(unused_comparisons)] if value.len() > 3usize { @@ -1239,7 +1239,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1410,7 +1410,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TextSlice<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.end; if *value < 0i64 { diff --git a/crates/weaver-api/src/app_bsky/feed/postgate.rs b/crates/weaver-api/src/app_bsky/feed/postgate.rs index 196efae..8516296 100644 --- a/crates/weaver-api/src/app_bsky/feed/postgate.rs +++ b/crates/weaver-api/src/app_bsky/feed/postgate.rs @@ -28,7 +28,7 @@ fn lexicon_doc_app_bsky_feed_postgate() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("disableRule"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -41,7 +41,7 @@ fn lexicon_doc_app_bsky_feed_postgate() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -66,7 +66,7 @@ fn lexicon_doc_app_bsky_feed_postgate() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -178,7 +178,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DisableRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -471,7 +471,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Postgate<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.detached_embedding_uris { #[allow(unused_comparisons)] if value.len() > 50usize { diff --git a/crates/weaver-api/src/app_bsky/feed/repost.rs b/crates/weaver-api/src/app_bsky/feed/repost.rs index 3c88b6b..56e8e0d 100644 --- a/crates/weaver-api/src/app_bsky/feed/repost.rs +++ b/crates/weaver-api/src/app_bsky/feed/repost.rs @@ -36,37 +36,37 @@ pub mod repost_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject(PhantomData S>); - impl sealed::Sealed for SetSubject {} - impl State for SetSubject { - type Subject = Set; - type CreatedAt = S::CreatedAt; + type Subject = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Subject = S::Subject; type CreatedAt = Set; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type CreatedAt = S::CreatedAt; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -159,8 +159,8 @@ impl<'a, S: repost_state::State> RepostBuilder<'a, S> { impl<'a, S> RepostBuilder<'a, S> where S: repost_state::State, - S::Subject: repost_state::IsSet, S::CreatedAt: repost_state::IsSet, + S::Subject: repost_state::IsSet, { /// Build the final struct pub fn build(self) -> Repost<'a> { @@ -261,7 +261,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Repost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -275,7 +275,7 @@ fn lexicon_doc_app_bsky_feed_repost() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -296,7 +296,7 @@ fn lexicon_doc_app_bsky_feed_repost() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/feed/search_posts.rs b/crates/weaver-api/src/app_bsky/feed/search_posts.rs index 90d2fd2..f4932ce 100644 --- a/crates/weaver-api/src/app_bsky/feed/search_posts.rs +++ b/crates/weaver-api/src/app_bsky/feed/search_posts.rs @@ -405,8 +405,8 @@ pub enum SearchPostsError<'a> { BadQueryString(std::option::Option>), } -impl std::fmt::Display for SearchPostsError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SearchPostsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BadQueryString(msg) => { write!(f, "BadQueryString")?; diff --git a/crates/weaver-api/src/app_bsky/feed/threadgate.rs b/crates/weaver-api/src/app_bsky/feed/threadgate.rs index e68990f..2bdeef9 100644 --- a/crates/weaver-api/src/app_bsky/feed/threadgate.rs +++ b/crates/weaver-api/src/app_bsky/feed/threadgate.rs @@ -28,7 +28,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("followerRule"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -41,7 +41,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -77,7 +77,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("list"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -119,7 +119,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("allow"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -227,7 +227,7 @@ fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -249,7 +249,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowerRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -280,7 +280,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowingRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -419,7 +419,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -730,7 +730,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Threadgate<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.allow { #[allow(unused_comparisons)] if value.len() > 5usize { @@ -785,7 +785,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MentionRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/graph.rs b/crates/weaver-api/src/app_bsky/graph.rs index 558b5ad..2b33593 100644 --- a/crates/weaver-api/src/app_bsky/graph.rs +++ b/crates/weaver-api/src/app_bsky/graph.rs @@ -82,37 +82,37 @@ pub mod list_item_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type Uri; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type Uri = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject(PhantomData S>); - impl sealed::Sealed for SetSubject {} - impl State for SetSubject { - type Subject = Set; - type Uri = S::Uri; + type Subject = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Subject = S::Subject; type Uri = Set; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type Uri = S::Uri; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -185,8 +185,8 @@ where impl<'a, S> ListItemViewBuilder<'a, S> where S: list_item_view_state::State, - S::Subject: list_item_view_state::IsSet, S::Uri: list_item_view_state::IsSet, + S::Subject: list_item_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListItemView<'a> { @@ -221,7 +221,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("curatelist"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { @@ -241,7 +241,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -304,7 +304,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -494,7 +494,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -635,7 +635,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocked"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -688,7 +688,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -738,7 +738,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -822,7 +822,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -990,7 +990,7 @@ fn lexicon_doc_app_bsky_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1133,7 +1133,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItemView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1185,6 +1185,12 @@ impl<'a> AsRef for ListPurpose<'a> { } } +impl<'a> core::fmt::Display for ListPurpose<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ListPurpose<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1277,105 +1283,105 @@ pub mod list_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; + type Purpose; + type Cid; type Uri; type IndexedAt; - type Purpose; + type Name; type Creator; - type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; + type Purpose = Unset; + type Cid = Unset; type Uri = Unset; type IndexedAt = Unset; - type Purpose = Unset; + type Name = Unset; type Creator = Unset; - type Cid = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Name = Set; + ///State transition - sets the `purpose` field to Set + pub struct SetPurpose(PhantomData S>); + impl sealed::Sealed for SetPurpose {} + impl State for SetPurpose { + type Purpose = Set; + type Cid = S::Cid; type Uri = S::Uri; type IndexedAt = S::IndexedAt; + type Name = S::Name; + type Creator = S::Creator; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { type Purpose = S::Purpose; + type Cid = Set; + type Uri = S::Uri; + type IndexedAt = S::IndexedAt; + type Name = S::Name; type Creator = S::Creator; - type Cid = S::Cid; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Name = S::Name; + type Purpose = S::Purpose; + type Cid = S::Cid; type Uri = Set; type IndexedAt = S::IndexedAt; - type Purpose = S::Purpose; + type Name = S::Name; type Creator = S::Creator; - type Cid = S::Cid; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Name = S::Name; + type Purpose = S::Purpose; + type Cid = S::Cid; type Uri = S::Uri; type IndexedAt = Set; - type Purpose = S::Purpose; + type Name = S::Name; type Creator = S::Creator; - type Cid = S::Cid; } - ///State transition - sets the `purpose` field to Set - pub struct SetPurpose(PhantomData S>); - impl sealed::Sealed for SetPurpose {} - impl State for SetPurpose { - type Name = S::Name; + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Purpose = S::Purpose; + type Cid = S::Cid; type Uri = S::Uri; type IndexedAt = S::IndexedAt; - type Purpose = Set; + type Name = Set; type Creator = S::Creator; - type Cid = S::Cid; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { - type Name = S::Name; - type Uri = S::Uri; - type IndexedAt = S::IndexedAt; type Purpose = S::Purpose; - type Creator = Set; type Cid = S::Cid; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Name = S::Name; type Uri = S::Uri; type IndexedAt = S::IndexedAt; - type Purpose = S::Purpose; - type Creator = S::Creator; - type Cid = Set; + type Name = S::Name; + type Creator = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); + ///Marker type for the `purpose` field + pub struct purpose(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `purpose` field - pub struct purpose(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `creator` field pub struct creator(()); - ///Marker type for the `cid` field - pub struct cid(()); } } @@ -1655,12 +1661,12 @@ impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { impl<'a, S> ListViewBuilder<'a, S> where S: list_view_state::State, - S::Name: list_view_state::IsSet, + S::Purpose: list_view_state::IsSet, + S::Cid: list_view_state::IsSet, S::Uri: list_view_state::IsSet, S::IndexedAt: list_view_state::IsSet, - S::Purpose: list_view_state::IsSet, + S::Name: list_view_state::IsSet, S::Creator: list_view_state::IsSet, - S::Cid: list_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListView<'a> { @@ -1718,7 +1724,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -1835,65 +1841,65 @@ pub mod list_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; type Purpose; + type Uri; type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; type Purpose = Unset; + type Uri = Unset; type Name = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; - type Purpose = S::Purpose; - type Name = S::Name; - } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; type Purpose = S::Purpose; + type Uri = S::Uri; type Name = S::Name; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose(PhantomData S>); impl sealed::Sealed for SetPurpose {} impl State for SetPurpose { - type Uri = S::Uri; type Cid = S::Cid; type Purpose = Set; + type Uri = S::Uri; + type Name = S::Name; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Purpose = S::Purpose; + type Uri = Set; type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { - type Uri = S::Uri; type Cid = S::Cid; type Purpose = S::Purpose; + type Uri = S::Uri; type Name = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `purpose` field pub struct purpose(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `name` field pub struct name(()); } @@ -2112,9 +2118,9 @@ impl<'a, S: list_view_basic_state::State> ListViewBasicBuilder<'a, S> { impl<'a, S> ListViewBasicBuilder<'a, S> where S: list_view_basic_state::State, - S::Uri: list_view_basic_state::IsSet, S::Cid: list_view_basic_state::IsSet, S::Purpose: list_view_basic_state::IsSet, + S::Uri: list_view_basic_state::IsSet, S::Name: list_view_basic_state::IsSet, { /// Build the final struct @@ -2167,7 +2173,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListViewBasic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.list_item_count { if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { @@ -2241,7 +2247,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListViewerState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2292,37 +2298,37 @@ pub mod not_found_actor_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NotFound; type Actor; + type NotFound; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NotFound = Unset; type Actor = Unset; - } - ///State transition - sets the `not_found` field to Set - pub struct SetNotFound(PhantomData S>); - impl sealed::Sealed for SetNotFound {} - impl State for SetNotFound { - type NotFound = Set; - type Actor = S::Actor; + type NotFound = Unset; } ///State transition - sets the `actor` field to Set pub struct SetActor(PhantomData S>); impl sealed::Sealed for SetActor {} impl State for SetActor { - type NotFound = S::NotFound; type Actor = Set; + type NotFound = S::NotFound; + } + ///State transition - sets the `not_found` field to Set + pub struct SetNotFound(PhantomData S>); + impl sealed::Sealed for SetNotFound {} + impl State for SetNotFound { + type Actor = S::Actor; + type NotFound = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `not_found` field - pub struct not_found(()); ///Marker type for the `actor` field pub struct actor(()); + ///Marker type for the `not_found` field + pub struct not_found(()); } } @@ -2395,8 +2401,8 @@ where impl<'a, S> NotFoundActorBuilder<'a, S> where S: not_found_actor_state::State, - S::NotFound: not_found_actor_state::IsSet, S::Actor: not_found_actor_state::IsSet, + S::NotFound: not_found_actor_state::IsSet, { /// Build the final struct pub fn build(self) -> NotFoundActor<'a> { @@ -2434,7 +2440,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotFoundActor<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2643,7 +2649,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Relationship<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2699,85 +2705,85 @@ pub mod starter_pack_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; + type IndexedAt; type Record; - type Uri; + type Cid; type Creator; - type IndexedAt; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; + type IndexedAt = Unset; type Record = Unset; - type Uri = Unset; + type Cid = Unset; type Creator = Unset; - type IndexedAt = Unset; + type Uri = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type IndexedAt = Set; type Record = S::Record; - type Uri = S::Uri; + type Cid = S::Cid; type Creator = S::Creator; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Cid = S::Cid; + type IndexedAt = S::IndexedAt; type Record = Set; - type Uri = S::Uri; + type Cid = S::Cid; type Creator = S::Creator; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Cid = S::Cid; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type IndexedAt = S::IndexedAt; type Record = S::Record; - type Uri = Set; + type Cid = Set; type Creator = S::Creator; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { - type Cid = S::Cid; + type IndexedAt = S::IndexedAt; type Record = S::Record; - type Uri = S::Uri; + type Cid = S::Cid; type Creator = Set; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Cid = S::Cid; + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type IndexedAt = S::IndexedAt; type Record = S::Record; - type Uri = S::Uri; + type Cid = S::Cid; type Creator = S::Creator; - type IndexedAt = Set; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `record` field pub struct record(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `creator` field pub struct creator(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -3030,11 +3036,11 @@ where impl<'a, S> StarterPackViewBuilder<'a, S> where S: starter_pack_view_state::State, - S::Cid: starter_pack_view_state::IsSet, + S::IndexedAt: starter_pack_view_state::IsSet, S::Record: starter_pack_view_state::IsSet, - S::Uri: starter_pack_view_state::IsSet, + S::Cid: starter_pack_view_state::IsSet, S::Creator: starter_pack_view_state::IsSet, - S::IndexedAt: starter_pack_view_state::IsSet, + S::Uri: starter_pack_view_state::IsSet, { /// Build the final struct pub fn build(self) -> StarterPackView<'a> { @@ -3090,7 +3096,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StarterPackView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.feeds { #[allow(unused_comparisons)] if value.len() > 3usize { @@ -3183,83 +3189,83 @@ pub mod starter_pack_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type IndexedAt; + type Creator; type Cid; type Uri; - type Creator; - type IndexedAt; type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type IndexedAt = Unset; + type Creator = Unset; type Cid = Unset; type Uri = Unset; - type Creator = Unset; - type IndexedAt = Unset; type Record = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; - type Uri = S::Uri; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type IndexedAt = Set; type Creator = S::Creator; - type IndexedAt = S::IndexedAt; - type Record = S::Record; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { type Cid = S::Cid; - type Uri = Set; - type Creator = S::Creator; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; type Record = S::Record; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { + type IndexedAt = S::IndexedAt; + type Creator = Set; type Cid = S::Cid; type Uri = S::Uri; - type Creator = Set; - type IndexedAt = S::IndexedAt; type Record = S::Record; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Cid = S::Cid; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; + type Cid = Set; type Uri = S::Uri; + type Record = S::Record; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type IndexedAt = S::IndexedAt; type Creator = S::Creator; - type IndexedAt = Set; + type Cid = S::Cid; + type Uri = Set; type Record = S::Record; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; type Cid = S::Cid; type Uri = S::Uri; - type Creator = S::Creator; - type IndexedAt = S::IndexedAt; type Record = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `creator` field + pub struct creator(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `creator` field - pub struct creator(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `record` field pub struct record(()); } @@ -3472,10 +3478,10 @@ where impl<'a, S> StarterPackViewBasicBuilder<'a, S> where S: starter_pack_view_basic_state::State, + S::IndexedAt: starter_pack_view_basic_state::IsSet, + S::Creator: starter_pack_view_basic_state::IsSet, S::Cid: starter_pack_view_basic_state::IsSet, S::Uri: starter_pack_view_basic_state::IsSet, - S::Creator: starter_pack_view_basic_state::IsSet, - S::IndexedAt: starter_pack_view_basic_state::IsSet, S::Record: starter_pack_view_basic_state::IsSet, { /// Build the final struct @@ -3528,7 +3534,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StarterPackViewBasic<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.joined_all_time_count { if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { diff --git a/crates/weaver-api/src/app_bsky/graph/block.rs b/crates/weaver-api/src/app_bsky/graph/block.rs index 8fb41f0..f3cd782 100644 --- a/crates/weaver-api/src/app_bsky/graph/block.rs +++ b/crates/weaver-api/src/app_bsky/graph/block.rs @@ -34,37 +34,37 @@ pub mod block_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type CreatedAt = S::CreatedAt; type Subject = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Subject = S::Subject; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, - S::CreatedAt: block_state::IsSet, S::Subject: block_state::IsSet, + S::CreatedAt: block_state::IsSet, { /// Build the final struct pub fn build(self) -> Block<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Block<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_app_bsky_graph_block() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_app_bsky_graph_block() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/graph/follow.rs b/crates/weaver-api/src/app_bsky/graph/follow.rs index 0fa2f29..648570c 100644 --- a/crates/weaver-api/src/app_bsky/graph/follow.rs +++ b/crates/weaver-api/src/app_bsky/graph/follow.rs @@ -36,37 +36,37 @@ pub mod follow_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type CreatedAt = S::CreatedAt; type Subject = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Subject = S::Subject; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -159,8 +159,8 @@ impl<'a, S: follow_state::State> FollowBuilder<'a, S> { impl<'a, S> FollowBuilder<'a, S> where S: follow_state::State, - S::CreatedAt: follow_state::IsSet, S::Subject: follow_state::IsSet, + S::CreatedAt: follow_state::IsSet, { /// Build the final struct pub fn build(self) -> Follow<'a> { @@ -261,7 +261,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Follow<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -275,7 +275,7 @@ fn lexicon_doc_app_bsky_graph_follow() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -296,7 +296,7 @@ fn lexicon_doc_app_bsky_graph_follow() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/graph/get_lists_with_membership.rs b/crates/weaver-api/src/app_bsky/graph/get_lists_with_membership.rs index 79eb564..2940421 100644 --- a/crates/weaver-api/src/app_bsky/graph/get_lists_with_membership.rs +++ b/crates/weaver-api/src/app_bsky/graph/get_lists_with_membership.rs @@ -163,7 +163,7 @@ fn lexicon_doc_app_bsky_graph_getListsWithMembership() -> ::jacquard_lexicon::le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("listWithMembership"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -178,7 +178,7 @@ fn lexicon_doc_app_bsky_graph_getListsWithMembership() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("list"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -215,7 +215,7 @@ fn lexicon_doc_app_bsky_graph_getListsWithMembership() -> ::jacquard_lexicon::le ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -310,7 +310,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListWithMembership<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/app_bsky/graph/get_relationships.rs b/crates/weaver-api/src/app_bsky/graph/get_relationships.rs index f5f0420..ee2b306 100644 --- a/crates/weaver-api/src/app_bsky/graph/get_relationships.rs +++ b/crates/weaver-api/src/app_bsky/graph/get_relationships.rs @@ -195,8 +195,8 @@ pub enum GetRelationshipsError<'a> { ActorNotFound(std::option::Option>), } -impl std::fmt::Display for GetRelationshipsError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRelationshipsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ActorNotFound(msg) => { write!(f, "ActorNotFound")?; diff --git a/crates/weaver-api/src/app_bsky/graph/get_starter_packs_with_membership.rs b/crates/weaver-api/src/app_bsky/graph/get_starter_packs_with_membership.rs index e3a2ab7..4b40aa9 100644 --- a/crates/weaver-api/src/app_bsky/graph/get_starter_packs_with_membership.rs +++ b/crates/weaver-api/src/app_bsky/graph/get_starter_packs_with_membership.rs @@ -391,7 +391,7 @@ fn lexicon_doc_app_bsky_graph_getStarterPacksWithMembership() -> ::jacquard_lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -406,7 +406,7 @@ fn lexicon_doc_app_bsky_graph_getStarterPacksWithMembership() -> ::jacquard_lexi ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -480,7 +480,7 @@ fn lexicon_doc_app_bsky_graph_getStarterPacksWithMembership() -> ::jacquard_lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("listItem"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -522,7 +522,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StarterPackWithMembership } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/graph/list.rs b/crates/weaver-api/src/app_bsky/graph/list.rs index 6266919..1c7816d 100644 --- a/crates/weaver-api/src/app_bsky/graph/list.rs +++ b/crates/weaver-api/src/app_bsky/graph/list.rs @@ -51,51 +51,51 @@ pub mod list_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Purpose; type Name; + type Purpose; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Purpose = Unset; type Name = Unset; + type Purpose = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Name = Set; type Purpose = S::Purpose; - type Name = S::Name; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose(PhantomData S>); impl sealed::Sealed for SetPurpose {} impl State for SetPurpose { - type CreatedAt = S::CreatedAt; - type Purpose = Set; type Name = S::Name; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { + type Purpose = Set; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Name = S::Name; type Purpose = S::Purpose; - type Name = Set; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `purpose` field - pub struct purpose(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `purpose` field + pub struct purpose(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -268,9 +268,9 @@ where impl<'a, S> ListBuilder<'a, S> where S: list_state::State, - S::CreatedAt: list_state::IsSet, - S::Purpose: list_state::IsSet, S::Name: list_state::IsSet, + S::Purpose: list_state::IsSet, + S::CreatedAt: list_state::IsSet, { /// Build the final struct pub fn build(self) -> List<'a> { @@ -379,7 +379,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for List<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -449,7 +449,7 @@ fn lexicon_doc_app_bsky_graph_list() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -471,7 +471,7 @@ fn lexicon_doc_app_bsky_graph_list() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { diff --git a/crates/weaver-api/src/app_bsky/graph/listblock.rs b/crates/weaver-api/src/app_bsky/graph/listblock.rs index b81e93c..1faa447 100644 --- a/crates/weaver-api/src/app_bsky/graph/listblock.rs +++ b/crates/weaver-api/src/app_bsky/graph/listblock.rs @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Listblock<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_app_bsky_graph_listblock() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_app_bsky_graph_listblock() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/graph/listitem.rs b/crates/weaver-api/src/app_bsky/graph/listitem.rs index 70106a1..4deb4ad 100644 --- a/crates/weaver-api/src/app_bsky/graph/listitem.rs +++ b/crates/weaver-api/src/app_bsky/graph/listitem.rs @@ -37,49 +37,49 @@ pub mod listitem_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type List; type Subject; + type List; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type List = Unset; type Subject = Unset; + type List = Unset; type CreatedAt = Unset; } - ///State transition - sets the `list` field to Set - pub struct SetList(PhantomData S>); - impl sealed::Sealed for SetList {} - impl State for SetList { - type List = Set; - type Subject = S::Subject; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type List = S::List; type Subject = Set; + type List = S::List; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `list` field to Set + pub struct SetList(PhantomData S>); + impl sealed::Sealed for SetList {} + impl State for SetList { + type Subject = S::Subject; + type List = Set; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type List = S::List; type Subject = S::Subject; + type List = S::List; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `list` field - pub struct list(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `list` field + pub struct list(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -174,8 +174,8 @@ where impl<'a, S> ListitemBuilder<'a, S> where S: listitem_state::State, - S::List: listitem_state::IsSet, S::Subject: listitem_state::IsSet, + S::List: listitem_state::IsSet, S::CreatedAt: listitem_state::IsSet, { /// Build the final struct @@ -277,7 +277,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Listitem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -291,7 +291,7 @@ fn lexicon_doc_app_bsky_graph_listitem() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -313,7 +313,7 @@ fn lexicon_doc_app_bsky_graph_listitem() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/graph/starterpack.rs b/crates/weaver-api/src/app_bsky/graph/starterpack.rs index 79819b2..508139f 100644 --- a/crates/weaver-api/src/app_bsky/graph/starterpack.rs +++ b/crates/weaver-api/src/app_bsky/graph/starterpack.rs @@ -135,7 +135,7 @@ fn lexicon_doc_app_bsky_graph_starterpack() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("feedItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_app_bsky_graph_starterpack() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -189,7 +189,7 @@ fn lexicon_doc_app_bsky_graph_starterpack() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -316,7 +316,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -366,49 +366,49 @@ pub mod starterpack_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type CreatedAt; + type Name; type List; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type CreatedAt = Unset; + type Name = Unset; type List = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Name = Set; - type CreatedAt = S::CreatedAt; - type List = S::List; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Name = S::Name; type CreatedAt = Set; + type Name = S::Name; + type List = S::List; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type CreatedAt = S::CreatedAt; + type Name = Set; type List = S::List; } ///State transition - sets the `list` field to Set pub struct SetList(PhantomData S>); impl sealed::Sealed for SetList {} impl State for SetList { - type Name = S::Name; type CreatedAt = S::CreatedAt; + type Name = S::Name; type List = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `list` field pub struct list(()); } @@ -563,8 +563,8 @@ where impl<'a, S> StarterpackBuilder<'a, S> where S: starterpack_state::State, - S::Name: starterpack_state::IsSet, S::CreatedAt: starterpack_state::IsSet, + S::Name: starterpack_state::IsSet, S::List: starterpack_state::IsSet, { /// Build the final struct @@ -672,7 +672,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Starterpack<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { diff --git a/crates/weaver-api/src/app_bsky/graph/verification.rs b/crates/weaver-api/src/app_bsky/graph/verification.rs index 42af8a3..7a31b6b 100644 --- a/crates/weaver-api/src/app_bsky/graph/verification.rs +++ b/crates/weaver-api/src/app_bsky/graph/verification.rs @@ -41,8 +41,8 @@ pub mod verification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type DisplayName; type Subject; + type DisplayName; type Handle; type CreatedAt; } @@ -50,26 +50,26 @@ pub mod verification_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type DisplayName = Unset; type Subject = Unset; + type DisplayName = Unset; type Handle = Unset; type CreatedAt = Unset; } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName(PhantomData S>); - impl sealed::Sealed for SetDisplayName {} - impl State for SetDisplayName { - type DisplayName = Set; - type Subject = S::Subject; - type Handle = S::Handle; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type DisplayName = S::DisplayName; type Subject = Set; + type DisplayName = S::DisplayName; + type Handle = S::Handle; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName(PhantomData S>); + impl sealed::Sealed for SetDisplayName {} + impl State for SetDisplayName { + type Subject = S::Subject; + type DisplayName = Set; type Handle = S::Handle; type CreatedAt = S::CreatedAt; } @@ -77,8 +77,8 @@ pub mod verification_state { pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { - type DisplayName = S::DisplayName; type Subject = S::Subject; + type DisplayName = S::DisplayName; type Handle = Set; type CreatedAt = S::CreatedAt; } @@ -86,18 +86,18 @@ pub mod verification_state { pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type DisplayName = S::DisplayName; type Subject = S::Subject; + type DisplayName = S::DisplayName; type Handle = S::Handle; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `display_name` field - pub struct display_name(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `display_name` field + pub struct display_name(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `created_at` field @@ -214,8 +214,8 @@ where impl<'a, S> VerificationBuilder<'a, S> where S: verification_state::State, - S::DisplayName: verification_state::IsSet, S::Subject: verification_state::IsSet, + S::DisplayName: verification_state::IsSet, S::Handle: verification_state::IsSet, S::CreatedAt: verification_state::IsSet, { @@ -320,7 +320,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Verification<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -334,7 +334,7 @@ fn lexicon_doc_app_bsky_graph_verification() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -357,7 +357,7 @@ fn lexicon_doc_app_bsky_graph_verification() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/labeler.rs b/crates/weaver-api/src/app_bsky/labeler.rs index c44f1be..3625e70 100644 --- a/crates/weaver-api/src/app_bsky/labeler.rs +++ b/crates/weaver-api/src/app_bsky/labeler.rs @@ -169,7 +169,7 @@ fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("labelerPolicies"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -182,7 +182,7 @@ fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "labelValueDefinitions", @@ -242,7 +242,7 @@ fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -361,7 +361,7 @@ fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -549,7 +549,7 @@ fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("like"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -588,7 +588,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerPolicies<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -632,8 +632,8 @@ pub mod labeler_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type IndexedAt; + type Cid; type Uri; type Creator; } @@ -641,26 +641,26 @@ pub mod labeler_view_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type IndexedAt = Unset; + type Cid = Unset; type Uri = Unset; type Creator = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; - type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Creator = S::Creator; - } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Cid = S::Cid; type IndexedAt = Set; + type Cid = S::Cid; + type Uri = S::Uri; + type Creator = S::Creator; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type IndexedAt = S::IndexedAt; + type Cid = Set; type Uri = S::Uri; type Creator = S::Creator; } @@ -668,8 +668,8 @@ pub mod labeler_view_state { pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Uri = Set; type Creator = S::Creator; } @@ -677,18 +677,18 @@ pub mod labeler_view_state { pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Uri = S::Uri; type Creator = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `creator` field @@ -859,8 +859,8 @@ impl<'a, S: labeler_view_state::State> LabelerViewBuilder<'a, S> { impl<'a, S> LabelerViewBuilder<'a, S> where S: labeler_view_state::State, - S::Cid: labeler_view_state::IsSet, S::IndexedAt: labeler_view_state::IsSet, + S::Cid: labeler_view_state::IsSet, S::Uri: labeler_view_state::IsSet, S::Creator: labeler_view_state::IsSet, { @@ -910,7 +910,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.like_count { if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { @@ -986,84 +986,84 @@ pub mod labeler_view_detailed_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Policies; - type IndexedAt; type Cid; - type Uri; + type IndexedAt; type Creator; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Policies = Unset; - type IndexedAt = Unset; type Cid = Unset; - type Uri = Unset; + type IndexedAt = Unset; type Creator = Unset; + type Uri = Unset; } ///State transition - sets the `policies` field to Set pub struct SetPolicies(PhantomData S>); impl sealed::Sealed for SetPolicies {} impl State for SetPolicies { type Policies = Set; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Creator = S::Creator; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Policies = S::Policies; - type IndexedAt = Set; - type Cid = S::Cid; type Uri = S::Uri; - type Creator = S::Creator; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type Policies = S::Policies; - type IndexedAt = S::IndexedAt; type Cid = Set; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Creator = S::Creator; + type Uri = S::Uri; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { type Policies = S::Policies; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type Uri = Set; + type IndexedAt = Set; type Creator = S::Creator; + type Uri = S::Uri; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { type Policies = S::Policies; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Creator = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Policies = S::Policies; + type Cid = S::Cid; + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `policies` field pub struct policies(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `creator` field pub struct creator(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -1323,10 +1323,10 @@ impl<'a, S> LabelerViewDetailedBuilder<'a, S> where S: labeler_view_detailed_state::State, S::Policies: labeler_view_detailed_state::IsSet, - S::IndexedAt: labeler_view_detailed_state::IsSet, S::Cid: labeler_view_detailed_state::IsSet, - S::Uri: labeler_view_detailed_state::IsSet, + S::IndexedAt: labeler_view_detailed_state::IsSet, S::Creator: labeler_view_detailed_state::IsSet, + S::Uri: labeler_view_detailed_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelerViewDetailed<'a> { @@ -1382,7 +1382,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerViewDetailed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.like_count { if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { @@ -1428,7 +1428,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerViewerState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/labeler/service.rs b/crates/weaver-api/src/app_bsky/labeler/service.rs index c9ccb61..ae1bb2f 100644 --- a/crates/weaver-api/src/app_bsky/labeler/service.rs +++ b/crates/weaver-api/src/app_bsky/labeler/service.rs @@ -54,37 +54,37 @@ pub mod service_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Policies; type CreatedAt; + type Policies; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Policies = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `policies` field to Set - pub struct SetPolicies(PhantomData S>); - impl sealed::Sealed for SetPolicies {} - impl State for SetPolicies { - type Policies = Set; - type CreatedAt = S::CreatedAt; + type Policies = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Policies = S::Policies; type CreatedAt = Set; + type Policies = S::Policies; + } + ///State transition - sets the `policies` field to Set + pub struct SetPolicies(PhantomData S>); + impl sealed::Sealed for SetPolicies {} + impl State for SetPolicies { + type CreatedAt = S::CreatedAt; + type Policies = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `policies` field - pub struct policies(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `policies` field + pub struct policies(()); } } @@ -237,8 +237,8 @@ impl<'a, S: service_state::State> ServiceBuilder<'a, S> { impl<'a, S> ServiceBuilder<'a, S> where S: service_state::State, - S::Policies: service_state::IsSet, S::CreatedAt: service_state::IsSet, + S::Policies: service_state::IsSet, { /// Build the final struct pub fn build(self) -> Service<'a> { @@ -345,7 +345,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Service<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -359,7 +359,7 @@ fn lexicon_doc_app_bsky_labeler_service() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -380,7 +380,7 @@ fn lexicon_doc_app_bsky_labeler_service() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/app_bsky/notification.rs b/crates/weaver-api/src/app_bsky/notification.rs index 8180b72..d3d0656 100644 --- a/crates/weaver-api/src/app_bsky/notification.rs +++ b/crates/weaver-api/src/app_bsky/notification.rs @@ -179,7 +179,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("activitySubscription"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -193,7 +193,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("post"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -227,7 +227,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("include"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -269,7 +269,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("include"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -318,7 +318,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("list"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -363,7 +363,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("chat"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -495,7 +495,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -519,7 +519,7 @@ fn lexicon_doc_app_bsky_notification_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "activitySubscription", @@ -569,7 +569,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ActivitySubscription<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -587,7 +587,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ActivitySubscription<'a> #[serde(rename_all = "camelCase")] pub struct ChatPreference<'a> { #[serde(borrow)] - pub include: jacquard_common::CowStr<'a>, + pub include: ChatPreferenceInclude<'a>, pub push: bool, } @@ -601,37 +601,37 @@ pub mod chat_preference_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Push; type Include; + type Push; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Push = Unset; type Include = Unset; - } - ///State transition - sets the `push` field to Set - pub struct SetPush(PhantomData S>); - impl sealed::Sealed for SetPush {} - impl State for SetPush { - type Push = Set; - type Include = S::Include; + type Push = Unset; } ///State transition - sets the `include` field to Set pub struct SetInclude(PhantomData S>); impl sealed::Sealed for SetInclude {} impl State for SetInclude { - type Push = S::Push; type Include = Set; + type Push = S::Push; + } + ///State transition - sets the `push` field to Set + pub struct SetPush(PhantomData S>); + impl sealed::Sealed for SetPush {} + impl State for SetPush { + type Include = S::Include; + type Push = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `push` field - pub struct push(()); ///Marker type for the `include` field pub struct include(()); + ///Marker type for the `push` field + pub struct push(()); } } @@ -639,7 +639,7 @@ pub mod chat_preference_state { pub struct ChatPreferenceBuilder<'a, S: chat_preference_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -671,7 +671,7 @@ where /// Set the `include` field (required) pub fn include( mut self, - value: impl Into>, + value: impl Into>, ) -> ChatPreferenceBuilder<'a, chat_preference_state::SetInclude> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ChatPreferenceBuilder { @@ -704,8 +704,8 @@ where impl<'a, S> ChatPreferenceBuilder<'a, S> where S: chat_preference_state::State, - S::Push: chat_preference_state::IsSet, S::Include: chat_preference_state::IsSet, + S::Push: chat_preference_state::IsSet, { /// Build the final struct pub fn build(self) -> ChatPreference<'a> { @@ -731,6 +731,96 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ChatPreferenceInclude<'a> { + All, + Accepted, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ChatPreferenceInclude<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::All => "all", + Self::Accepted => "accepted", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ChatPreferenceInclude<'a> { + fn from(s: &'a str) -> Self { + match s { + "all" => Self::All, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ChatPreferenceInclude<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "all" => Self::All, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ChatPreferenceInclude<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ChatPreferenceInclude<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ChatPreferenceInclude<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ChatPreferenceInclude<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ChatPreferenceInclude<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ChatPreferenceInclude<'_> { + type Output = ChatPreferenceInclude<'static>; + fn into_static(self) -> Self::Output { + match self { + ChatPreferenceInclude::All => ChatPreferenceInclude::All, + ChatPreferenceInclude::Accepted => ChatPreferenceInclude::Accepted, + ChatPreferenceInclude::Other(v) => { + ChatPreferenceInclude::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ChatPreference<'a> { fn nsid() -> &'static str { "app.bsky.notification.defs" @@ -743,7 +833,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ChatPreference<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -761,7 +851,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ChatPreference<'a> { #[serde(rename_all = "camelCase")] pub struct FilterablePreference<'a> { #[serde(borrow)] - pub include: jacquard_common::CowStr<'a>, + pub include: FilterablePreferenceInclude<'a>, pub list: bool, pub push: bool, } @@ -776,51 +866,51 @@ pub mod filterable_preference_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Include; - type List; type Push; + type List; + type Include; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Include = Unset; - type List = Unset; type Push = Unset; + type List = Unset; + type Include = Unset; } - ///State transition - sets the `include` field to Set - pub struct SetInclude(PhantomData S>); - impl sealed::Sealed for SetInclude {} - impl State for SetInclude { - type Include = Set; + ///State transition - sets the `push` field to Set + pub struct SetPush(PhantomData S>); + impl sealed::Sealed for SetPush {} + impl State for SetPush { + type Push = Set; type List = S::List; - type Push = S::Push; + type Include = S::Include; } ///State transition - sets the `list` field to Set pub struct SetList(PhantomData S>); impl sealed::Sealed for SetList {} impl State for SetList { - type Include = S::Include; - type List = Set; type Push = S::Push; - } - ///State transition - sets the `push` field to Set - pub struct SetPush(PhantomData S>); - impl sealed::Sealed for SetPush {} - impl State for SetPush { + type List = Set; type Include = S::Include; + } + ///State transition - sets the `include` field to Set + pub struct SetInclude(PhantomData S>); + impl sealed::Sealed for SetInclude {} + impl State for SetInclude { + type Push = S::Push; type List = S::List; - type Push = Set; + type Include = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `include` field - pub struct include(()); - ///Marker type for the `list` field - pub struct list(()); ///Marker type for the `push` field pub struct push(()); + ///Marker type for the `list` field + pub struct list(()); + ///Marker type for the `include` field + pub struct include(()); } } @@ -828,7 +918,7 @@ pub mod filterable_preference_state { pub struct FilterablePreferenceBuilder<'a, S: filterable_preference_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option, ), @@ -861,7 +951,7 @@ where /// Set the `include` field (required) pub fn include( mut self, - value: impl Into>, + value: impl Into>, ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetInclude> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); FilterablePreferenceBuilder { @@ -913,9 +1003,9 @@ where impl<'a, S> FilterablePreferenceBuilder<'a, S> where S: filterable_preference_state::State, - S::Include: filterable_preference_state::IsSet, - S::List: filterable_preference_state::IsSet, S::Push: filterable_preference_state::IsSet, + S::List: filterable_preference_state::IsSet, + S::Include: filterable_preference_state::IsSet, { /// Build the final struct pub fn build(self) -> FilterablePreference<'a> { @@ -943,6 +1033,96 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum FilterablePreferenceInclude<'a> { + All, + Follows, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> FilterablePreferenceInclude<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::All => "all", + Self::Follows => "follows", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for FilterablePreferenceInclude<'a> { + fn from(s: &'a str) -> Self { + match s { + "all" => Self::All, + "follows" => Self::Follows, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for FilterablePreferenceInclude<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "all" => Self::All, + "follows" => Self::Follows, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for FilterablePreferenceInclude<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for FilterablePreferenceInclude<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for FilterablePreferenceInclude<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for FilterablePreferenceInclude<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for FilterablePreferenceInclude<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for FilterablePreferenceInclude<'_> { + type Output = FilterablePreferenceInclude<'static>; + fn into_static(self) -> Self::Output { + match self { + FilterablePreferenceInclude::All => FilterablePreferenceInclude::All, + FilterablePreferenceInclude::Follows => FilterablePreferenceInclude::Follows, + FilterablePreferenceInclude::Other(v) => { + FilterablePreferenceInclude::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FilterablePreference<'a> { fn nsid() -> &'static str { "app.bsky.notification.defs" @@ -955,7 +1135,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FilterablePreference<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1125,7 +1305,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Preference<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1180,299 +1360,299 @@ pub mod preferences_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Mention; + type LikeViaRepost; type Reply; type Quote; - type Like; - type RepostViaRepost; - type SubscribedPost; - type Chat; type Repost; - type StarterpackJoined; - type Unverified; - type LikeViaRepost; type Follow; - type Mention; + type RepostViaRepost; + type Unverified; + type StarterpackJoined; + type Chat; + type Like; + type SubscribedPost; type Verified; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Mention = Unset; + type LikeViaRepost = Unset; type Reply = Unset; type Quote = Unset; - type Like = Unset; - type RepostViaRepost = Unset; - type SubscribedPost = Unset; - type Chat = Unset; type Repost = Unset; - type StarterpackJoined = Unset; - type Unverified = Unset; - type LikeViaRepost = Unset; type Follow = Unset; - type Mention = Unset; + type RepostViaRepost = Unset; + type Unverified = Unset; + type StarterpackJoined = Unset; + type Chat = Unset; + type Like = Unset; + type SubscribedPost = Unset; type Verified = Unset; } + ///State transition - sets the `mention` field to Set + pub struct SetMention(PhantomData S>); + impl sealed::Sealed for SetMention {} + impl State for SetMention { + type Mention = Set; + type LikeViaRepost = S::LikeViaRepost; + type Reply = S::Reply; + type Quote = S::Quote; + type Repost = S::Repost; + type Follow = S::Follow; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; + type Verified = S::Verified; + } + ///State transition - sets the `like_via_repost` field to Set + pub struct SetLikeViaRepost(PhantomData S>); + impl sealed::Sealed for SetLikeViaRepost {} + impl State for SetLikeViaRepost { + type Mention = S::Mention; + type LikeViaRepost = Set; + type Reply = S::Reply; + type Quote = S::Quote; + type Repost = S::Repost; + type Follow = S::Follow; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; + type Verified = S::Verified; + } ///State transition - sets the `reply` field to Set pub struct SetReply(PhantomData S>); impl sealed::Sealed for SetReply {} impl State for SetReply { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = Set; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } ///State transition - sets the `quote` field to Set pub struct SetQuote(PhantomData S>); impl sealed::Sealed for SetQuote {} impl State for SetQuote { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = Set; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } - ///State transition - sets the `like` field to Set - pub struct SetLike(PhantomData S>); - impl sealed::Sealed for SetLike {} - impl State for SetLike { + ///State transition - sets the `repost` field to Set + pub struct SetRepost(PhantomData S>); + impl sealed::Sealed for SetRepost {} + impl State for SetRepost { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = Set; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; + type Repost = Set; + type Follow = S::Follow; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; + type Verified = S::Verified; + } + ///State transition - sets the `follow` field to Set + pub struct SetFollow(PhantomData S>); + impl sealed::Sealed for SetFollow {} + impl State for SetFollow { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; + type Reply = S::Reply; + type Quote = S::Quote; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; + type Follow = Set; + type RepostViaRepost = S::RepostViaRepost; type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; - type Follow = S::Follow; - type Mention = S::Mention; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } ///State transition - sets the `repost_via_repost` field to Set pub struct SetRepostViaRepost(PhantomData S>); impl sealed::Sealed for SetRepostViaRepost {} impl State for SetRepostViaRepost { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = Set; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; + type RepostViaRepost = Set; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } - ///State transition - sets the `subscribed_post` field to Set - pub struct SetSubscribedPost(PhantomData S>); - impl sealed::Sealed for SetSubscribedPost {} - impl State for SetSubscribedPost { + ///State transition - sets the `unverified` field to Set + pub struct SetUnverified(PhantomData S>); + impl sealed::Sealed for SetUnverified {} + impl State for SetUnverified { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = Set; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; - type Verified = S::Verified; - } - ///State transition - sets the `chat` field to Set - pub struct SetChat(PhantomData S>); - impl sealed::Sealed for SetChat {} - impl State for SetChat { - type Reply = S::Reply; - type Quote = S::Quote; - type Like = S::Like; type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = Set; - type Repost = S::Repost; + type Unverified = Set; type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; - type Follow = S::Follow; - type Mention = S::Mention; - type Verified = S::Verified; - } - ///State transition - sets the `repost` field to Set - pub struct SetRepost(PhantomData S>); - impl sealed::Sealed for SetRepost {} - impl State for SetRepost { - type Reply = S::Reply; - type Quote = S::Quote; + type Chat = S::Chat; type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; - type Repost = Set; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; - type Follow = S::Follow; - type Mention = S::Mention; type Verified = S::Verified; } ///State transition - sets the `starterpack_joined` field to Set pub struct SetStarterpackJoined(PhantomData S>); impl sealed::Sealed for SetStarterpackJoined {} impl State for SetStarterpackJoined { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = Set; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; - type Verified = S::Verified; - } - ///State transition - sets the `unverified` field to Set - pub struct SetUnverified(PhantomData S>); - impl sealed::Sealed for SetUnverified {} - impl State for SetUnverified { - type Reply = S::Reply; - type Quote = S::Quote; - type Like = S::Like; type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; + type Unverified = S::Unverified; + type StarterpackJoined = Set; type Chat = S::Chat; - type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = Set; - type LikeViaRepost = S::LikeViaRepost; - type Follow = S::Follow; - type Mention = S::Mention; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } - ///State transition - sets the `like_via_repost` field to Set - pub struct SetLikeViaRepost(PhantomData S>); - impl sealed::Sealed for SetLikeViaRepost {} - impl State for SetLikeViaRepost { + ///State transition - sets the `chat` field to Set + pub struct SetChat(PhantomData S>); + impl sealed::Sealed for SetChat {} + impl State for SetChat { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = Set; type Follow = S::Follow; - type Mention = S::Mention; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = Set; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } - ///State transition - sets the `follow` field to Set - pub struct SetFollow(PhantomData S>); - impl sealed::Sealed for SetFollow {} - impl State for SetFollow { + ///State transition - sets the `like` field to Set + pub struct SetLike(PhantomData S>); + impl sealed::Sealed for SetLike {} + impl State for SetLike { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; + type Follow = S::Follow; + type RepostViaRepost = S::RepostViaRepost; type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; - type Follow = Set; - type Mention = S::Mention; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = Set; + type SubscribedPost = S::SubscribedPost; type Verified = S::Verified; } - ///State transition - sets the `mention` field to Set - pub struct SetMention(PhantomData S>); - impl sealed::Sealed for SetMention {} - impl State for SetMention { + ///State transition - sets the `subscribed_post` field to Set + pub struct SetSubscribedPost(PhantomData S>); + impl sealed::Sealed for SetSubscribedPost {} + impl State for SetSubscribedPost { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = Set; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = Set; type Verified = S::Verified; } ///State transition - sets the `verified` field to Set pub struct SetVerified(PhantomData S>); impl sealed::Sealed for SetVerified {} impl State for SetVerified { + type Mention = S::Mention; + type LikeViaRepost = S::LikeViaRepost; type Reply = S::Reply; type Quote = S::Quote; - type Like = S::Like; - type RepostViaRepost = S::RepostViaRepost; - type SubscribedPost = S::SubscribedPost; - type Chat = S::Chat; type Repost = S::Repost; - type StarterpackJoined = S::StarterpackJoined; - type Unverified = S::Unverified; - type LikeViaRepost = S::LikeViaRepost; type Follow = S::Follow; - type Mention = S::Mention; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type StarterpackJoined = S::StarterpackJoined; + type Chat = S::Chat; + type Like = S::Like; + type SubscribedPost = S::SubscribedPost; type Verified = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `mention` field + pub struct mention(()); + ///Marker type for the `like_via_repost` field + pub struct like_via_repost(()); ///Marker type for the `reply` field pub struct reply(()); ///Marker type for the `quote` field pub struct quote(()); - ///Marker type for the `like` field - pub struct like(()); - ///Marker type for the `repost_via_repost` field - pub struct repost_via_repost(()); - ///Marker type for the `subscribed_post` field - pub struct subscribed_post(()); - ///Marker type for the `chat` field - pub struct chat(()); ///Marker type for the `repost` field pub struct repost(()); - ///Marker type for the `starterpack_joined` field - pub struct starterpack_joined(()); - ///Marker type for the `unverified` field - pub struct unverified(()); - ///Marker type for the `like_via_repost` field - pub struct like_via_repost(()); ///Marker type for the `follow` field pub struct follow(()); - ///Marker type for the `mention` field - pub struct mention(()); + ///Marker type for the `repost_via_repost` field + pub struct repost_via_repost(()); + ///Marker type for the `unverified` field + pub struct unverified(()); + ///Marker type for the `starterpack_joined` field + pub struct starterpack_joined(()); + ///Marker type for the `chat` field + pub struct chat(()); + ///Marker type for the `like` field + pub struct like(()); + ///Marker type for the `subscribed_post` field + pub struct subscribed_post(()); ///Marker type for the `verified` field pub struct verified(()); } @@ -1781,18 +1961,18 @@ where impl<'a, S> PreferencesBuilder<'a, S> where S: preferences_state::State, + S::Mention: preferences_state::IsSet, + S::LikeViaRepost: preferences_state::IsSet, S::Reply: preferences_state::IsSet, S::Quote: preferences_state::IsSet, - S::Like: preferences_state::IsSet, - S::RepostViaRepost: preferences_state::IsSet, - S::SubscribedPost: preferences_state::IsSet, - S::Chat: preferences_state::IsSet, S::Repost: preferences_state::IsSet, - S::StarterpackJoined: preferences_state::IsSet, - S::Unverified: preferences_state::IsSet, - S::LikeViaRepost: preferences_state::IsSet, S::Follow: preferences_state::IsSet, - S::Mention: preferences_state::IsSet, + S::RepostViaRepost: preferences_state::IsSet, + S::Unverified: preferences_state::IsSet, + S::StarterpackJoined: preferences_state::IsSet, + S::Chat: preferences_state::IsSet, + S::Like: preferences_state::IsSet, + S::SubscribedPost: preferences_state::IsSet, S::Verified: preferences_state::IsSet, { /// Build the final struct @@ -1853,7 +2033,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Preferences<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1883,7 +2063,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordDeleted<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2073,7 +2253,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubjectActivitySubscripti } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/notification/declaration.rs b/crates/weaver-api/src/app_bsky/notification/declaration.rs index 32465b6..de804a7 100644 --- a/crates/weaver-api/src/app_bsky/notification/declaration.rs +++ b/crates/weaver-api/src/app_bsky/notification/declaration.rs @@ -20,7 +20,7 @@ pub struct Declaration<'a> { /// A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'. #[serde(borrow)] - pub allow_subscriptions: jacquard_common::CowStr<'a>, + pub allow_subscriptions: DeclarationAllowSubscriptions<'a>, } pub mod declaration_state { @@ -58,7 +58,7 @@ pub mod declaration_state { /// Builder for constructing an instance of this type pub struct DeclarationBuilder<'a, S: declaration_state::State> { _phantom_state: ::core::marker::PhantomData S>, - __unsafe_private_named: (::core::option::Option>,), + __unsafe_private_named: (::core::option::Option>,), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -88,7 +88,7 @@ where /// Set the `allowSubscriptions` field (required) pub fn allow_subscriptions( mut self, - value: impl Into>, + value: impl Into>, ) -> DeclarationBuilder<'a, declaration_state::SetAllowSubscriptions> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DeclarationBuilder { @@ -139,6 +139,106 @@ impl<'a> Declaration<'a> { } } +/// A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum DeclarationAllowSubscriptions<'a> { + Followers, + Mutuals, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> DeclarationAllowSubscriptions<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Followers => "followers", + Self::Mutuals => "mutuals", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for DeclarationAllowSubscriptions<'a> { + fn from(s: &'a str) -> Self { + match s { + "followers" => Self::Followers, + "mutuals" => Self::Mutuals, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for DeclarationAllowSubscriptions<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "followers" => Self::Followers, + "mutuals" => Self::Mutuals, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for DeclarationAllowSubscriptions<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for DeclarationAllowSubscriptions<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for DeclarationAllowSubscriptions<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for DeclarationAllowSubscriptions<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for DeclarationAllowSubscriptions<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for DeclarationAllowSubscriptions<'_> { + type Output = DeclarationAllowSubscriptions<'static>; + fn into_static(self) -> Self::Output { + match self { + DeclarationAllowSubscriptions::Followers => { + DeclarationAllowSubscriptions::Followers + } + DeclarationAllowSubscriptions::Mutuals => { + DeclarationAllowSubscriptions::Mutuals + } + DeclarationAllowSubscriptions::None => DeclarationAllowSubscriptions::None, + DeclarationAllowSubscriptions::Other(v) => { + DeclarationAllowSubscriptions::Other(v.into_static()) + } + } + } +} + /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, @@ -199,7 +299,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Declaration<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -213,7 +313,7 @@ fn lexicon_doc_app_bsky_notification_declaration() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -233,7 +333,7 @@ fn lexicon_doc_app_bsky_notification_declaration() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "allowSubscriptions", diff --git a/crates/weaver-api/src/app_bsky/notification/list_notifications.rs b/crates/weaver-api/src/app_bsky/notification/list_notifications.rs index f4118a2..071a963 100644 --- a/crates/weaver-api/src/app_bsky/notification/list_notifications.rs +++ b/crates/weaver-api/src/app_bsky/notification/list_notifications.rs @@ -251,7 +251,7 @@ pub struct Notification<'a> { pub labels: std::option::Option>>, /// The reason why this notification was delivered - e.g. your post was liked, or you received a new follower. #[serde(borrow)] - pub reason: jacquard_common::CowStr<'a>, + pub reason: NotificationReason<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub reason_subject: std::option::Option>, @@ -271,127 +271,127 @@ pub mod notification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IsRead; type Uri; + type Cid; + type Record; type Author; type Reason; + type IsRead; type IndexedAt; - type Cid; - type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IsRead = Unset; type Uri = Unset; + type Cid = Unset; + type Record = Unset; type Author = Unset; type Reason = Unset; + type IsRead = Unset; type IndexedAt = Unset; - type Cid = Unset; - type Record = Unset; - } - ///State transition - sets the `is_read` field to Set - pub struct SetIsRead(PhantomData S>); - impl sealed::Sealed for SetIsRead {} - impl State for SetIsRead { - type IsRead = Set; - type Uri = S::Uri; - type Author = S::Author; - type Reason = S::Reason; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; - type Record = S::Record; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type IsRead = S::IsRead; type Uri = Set; + type Cid = S::Cid; + type Record = S::Record; type Author = S::Author; type Reason = S::Reason; + type IsRead = S::IsRead; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Uri = S::Uri; + type Cid = Set; type Record = S::Record; + type Author = S::Author; + type Reason = S::Reason; + type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData S>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { + type Uri = S::Uri; + type Cid = S::Cid; + type Record = Set; + type Author = S::Author; + type Reason = S::Reason; + type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type IsRead = S::IsRead; type Uri = S::Uri; + type Cid = S::Cid; + type Record = S::Record; type Author = Set; type Reason = S::Reason; + type IsRead = S::IsRead; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; - type Record = S::Record; } ///State transition - sets the `reason` field to Set pub struct SetReason(PhantomData S>); impl sealed::Sealed for SetReason {} impl State for SetReason { - type IsRead = S::IsRead; type Uri = S::Uri; + type Cid = S::Cid; + type Record = S::Record; type Author = S::Author; type Reason = Set; + type IsRead = S::IsRead; type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `is_read` field to Set + pub struct SetIsRead(PhantomData S>); + impl sealed::Sealed for SetIsRead {} + impl State for SetIsRead { + type Uri = S::Uri; type Cid = S::Cid; type Record = S::Record; + type Author = S::Author; + type Reason = S::Reason; + type IsRead = Set; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type IsRead = S::IsRead; type Uri = S::Uri; - type Author = S::Author; - type Reason = S::Reason; - type IndexedAt = Set; type Cid = S::Cid; type Record = S::Record; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type IsRead = S::IsRead; - type Uri = S::Uri; type Author = S::Author; type Reason = S::Reason; - type IndexedAt = S::IndexedAt; - type Cid = Set; - type Record = S::Record; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord(PhantomData S>); - impl sealed::Sealed for SetRecord {} - impl State for SetRecord { type IsRead = S::IsRead; - type Uri = S::Uri; - type Author = S::Author; - type Reason = S::Reason; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; - type Record = Set; + type IndexedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `is_read` field - pub struct is_read(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `record` field + pub struct record(()); ///Marker type for the `author` field pub struct author(()); ///Marker type for the `reason` field pub struct reason(()); + ///Marker type for the `is_read` field + pub struct is_read(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `record` field - pub struct record(()); } } @@ -404,7 +404,7 @@ pub struct NotificationBuilder<'a, S: notification_state::State> { ::core::option::Option, ::core::option::Option, ::core::option::Option>>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, @@ -543,7 +543,7 @@ where /// Set the `reason` field (required) pub fn reason( mut self, - value: impl Into>, + value: impl Into>, ) -> NotificationBuilder<'a, notification_state::SetReason> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); NotificationBuilder { @@ -614,13 +614,13 @@ where impl<'a, S> NotificationBuilder<'a, S> where S: notification_state::State, - S::IsRead: notification_state::IsSet, S::Uri: notification_state::IsSet, + S::Cid: notification_state::IsSet, + S::Record: notification_state::IsSet, S::Author: notification_state::IsSet, S::Reason: notification_state::IsSet, + S::IsRead: notification_state::IsSet, S::IndexedAt: notification_state::IsSet, - S::Cid: notification_state::IsSet, - S::Record: notification_state::IsSet, { /// Build the final struct pub fn build(self) -> Notification<'a> { @@ -660,6 +660,147 @@ where } } +/// The reason why this notification was delivered - e.g. your post was liked, or you received a new follower. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum NotificationReason<'a> { + Like, + Repost, + Follow, + Mention, + Reply, + Quote, + StarterpackJoined, + Verified, + Unverified, + LikeViaRepost, + RepostViaRepost, + SubscribedPost, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> NotificationReason<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Like => "like", + Self::Repost => "repost", + Self::Follow => "follow", + Self::Mention => "mention", + Self::Reply => "reply", + Self::Quote => "quote", + Self::StarterpackJoined => "starterpack-joined", + Self::Verified => "verified", + Self::Unverified => "unverified", + Self::LikeViaRepost => "like-via-repost", + Self::RepostViaRepost => "repost-via-repost", + Self::SubscribedPost => "subscribed-post", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for NotificationReason<'a> { + fn from(s: &'a str) -> Self { + match s { + "like" => Self::Like, + "repost" => Self::Repost, + "follow" => Self::Follow, + "mention" => Self::Mention, + "reply" => Self::Reply, + "quote" => Self::Quote, + "starterpack-joined" => Self::StarterpackJoined, + "verified" => Self::Verified, + "unverified" => Self::Unverified, + "like-via-repost" => Self::LikeViaRepost, + "repost-via-repost" => Self::RepostViaRepost, + "subscribed-post" => Self::SubscribedPost, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for NotificationReason<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "like" => Self::Like, + "repost" => Self::Repost, + "follow" => Self::Follow, + "mention" => Self::Mention, + "reply" => Self::Reply, + "quote" => Self::Quote, + "starterpack-joined" => Self::StarterpackJoined, + "verified" => Self::Verified, + "unverified" => Self::Unverified, + "like-via-repost" => Self::LikeViaRepost, + "repost-via-repost" => Self::RepostViaRepost, + "subscribed-post" => Self::SubscribedPost, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for NotificationReason<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for NotificationReason<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for NotificationReason<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for NotificationReason<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for NotificationReason<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for NotificationReason<'_> { + type Output = NotificationReason<'static>; + fn into_static(self) -> Self::Output { + match self { + NotificationReason::Like => NotificationReason::Like, + NotificationReason::Repost => NotificationReason::Repost, + NotificationReason::Follow => NotificationReason::Follow, + NotificationReason::Mention => NotificationReason::Mention, + NotificationReason::Reply => NotificationReason::Reply, + NotificationReason::Quote => NotificationReason::Quote, + NotificationReason::StarterpackJoined => { + NotificationReason::StarterpackJoined + } + NotificationReason::Verified => NotificationReason::Verified, + NotificationReason::Unverified => NotificationReason::Unverified, + NotificationReason::LikeViaRepost => NotificationReason::LikeViaRepost, + NotificationReason::RepostViaRepost => NotificationReason::RepostViaRepost, + NotificationReason::SubscribedPost => NotificationReason::SubscribedPost, + NotificationReason::Other(v) => NotificationReason::Other(v.into_static()), + } + } +} + fn lexicon_doc_app_bsky_notification_listNotifications() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -671,7 +812,7 @@ fn lexicon_doc_app_bsky_notification_listNotifications() -> ::jacquard_lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -682,7 +823,7 @@ fn lexicon_doc_app_bsky_notification_listNotifications() -> ::jacquard_lexicon:: required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -786,7 +927,7 @@ fn lexicon_doc_app_bsky_notification_listNotifications() -> ::jacquard_lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -936,7 +1077,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Notification<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/notification/register_push.rs b/crates/weaver-api/src/app_bsky/notification/register_push.rs index be75103..08c082f 100644 --- a/crates/weaver-api/src/app_bsky/notification/register_push.rs +++ b/crates/weaver-api/src/app_bsky/notification/register_push.rs @@ -23,7 +23,7 @@ pub struct RegisterPush<'a> { #[serde(borrow)] pub app_id: jacquard_common::CowStr<'a>, #[serde(borrow)] - pub platform: jacquard_common::CowStr<'a>, + pub platform: RegisterPushPlatform<'a>, #[serde(borrow)] pub service_did: jacquard_common::types::string::Did<'a>, #[serde(borrow)] @@ -40,8 +40,8 @@ pub mod register_push_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ServiceDid; type Token; + type ServiceDid; type Platform; type AppId; } @@ -49,26 +49,26 @@ pub mod register_push_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ServiceDid = Unset; type Token = Unset; + type ServiceDid = Unset; type Platform = Unset; type AppId = Unset; } - ///State transition - sets the `service_did` field to Set - pub struct SetServiceDid(PhantomData S>); - impl sealed::Sealed for SetServiceDid {} - impl State for SetServiceDid { - type ServiceDid = Set; - type Token = S::Token; - type Platform = S::Platform; - type AppId = S::AppId; - } ///State transition - sets the `token` field to Set pub struct SetToken(PhantomData S>); impl sealed::Sealed for SetToken {} impl State for SetToken { - type ServiceDid = S::ServiceDid; type Token = Set; + type ServiceDid = S::ServiceDid; + type Platform = S::Platform; + type AppId = S::AppId; + } + ///State transition - sets the `service_did` field to Set + pub struct SetServiceDid(PhantomData S>); + impl sealed::Sealed for SetServiceDid {} + impl State for SetServiceDid { + type Token = S::Token; + type ServiceDid = Set; type Platform = S::Platform; type AppId = S::AppId; } @@ -76,8 +76,8 @@ pub mod register_push_state { pub struct SetPlatform(PhantomData S>); impl sealed::Sealed for SetPlatform {} impl State for SetPlatform { - type ServiceDid = S::ServiceDid; type Token = S::Token; + type ServiceDid = S::ServiceDid; type Platform = Set; type AppId = S::AppId; } @@ -85,18 +85,18 @@ pub mod register_push_state { pub struct SetAppId(PhantomData S>); impl sealed::Sealed for SetAppId {} impl State for SetAppId { - type ServiceDid = S::ServiceDid; type Token = S::Token; + type ServiceDid = S::ServiceDid; type Platform = S::Platform; type AppId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `service_did` field - pub struct service_did(()); ///Marker type for the `token` field pub struct token(()); + ///Marker type for the `service_did` field + pub struct service_did(()); ///Marker type for the `platform` field pub struct platform(()); ///Marker type for the `app_id` field @@ -110,7 +110,7 @@ pub struct RegisterPushBuilder<'a, S: register_push_state::State> { __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), @@ -175,7 +175,7 @@ where /// Set the `platform` field (required) pub fn platform( mut self, - value: impl Into>, + value: impl Into>, ) -> RegisterPushBuilder<'a, register_push_state::SetPlatform> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); RegisterPushBuilder { @@ -227,8 +227,8 @@ where impl<'a, S> RegisterPushBuilder<'a, S> where S: register_push_state::State, - S::ServiceDid: register_push_state::IsSet, S::Token: register_push_state::IsSet, + S::ServiceDid: register_push_state::IsSet, S::Platform: register_push_state::IsSet, S::AppId: register_push_state::IsSet, { @@ -262,6 +262,101 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RegisterPushPlatform<'a> { + Ios, + Android, + Web, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RegisterPushPlatform<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Ios => "ios", + Self::Android => "android", + Self::Web => "web", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RegisterPushPlatform<'a> { + fn from(s: &'a str) -> Self { + match s { + "ios" => Self::Ios, + "android" => Self::Android, + "web" => Self::Web, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RegisterPushPlatform<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "ios" => Self::Ios, + "android" => Self::Android, + "web" => Self::Web, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RegisterPushPlatform<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RegisterPushPlatform<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RegisterPushPlatform<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RegisterPushPlatform<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RegisterPushPlatform<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RegisterPushPlatform<'_> { + type Output = RegisterPushPlatform<'static>; + fn into_static(self) -> Self::Output { + match self { + RegisterPushPlatform::Ios => RegisterPushPlatform::Ios, + RegisterPushPlatform::Android => RegisterPushPlatform::Android, + RegisterPushPlatform::Web => RegisterPushPlatform::Web, + RegisterPushPlatform::Other(v) => { + RegisterPushPlatform::Other(v.into_static()) + } + } + } +} + /// Response type for ///app.bsky.notification.registerPush pub struct RegisterPushResponse; diff --git a/crates/weaver-api/src/app_bsky/notification/unregister_push.rs b/crates/weaver-api/src/app_bsky/notification/unregister_push.rs index 3704a64..52867ed 100644 --- a/crates/weaver-api/src/app_bsky/notification/unregister_push.rs +++ b/crates/weaver-api/src/app_bsky/notification/unregister_push.rs @@ -20,7 +20,7 @@ pub struct UnregisterPush<'a> { #[serde(borrow)] pub app_id: jacquard_common::CowStr<'a>, #[serde(borrow)] - pub platform: jacquard_common::CowStr<'a>, + pub platform: UnregisterPushPlatform<'a>, #[serde(borrow)] pub service_did: jacquard_common::types::string::Did<'a>, #[serde(borrow)] @@ -37,67 +37,67 @@ pub mod unregister_push_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Token; - type AppId; type ServiceDid; type Platform; + type AppId; + type Token; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Token = Unset; - type AppId = Unset; type ServiceDid = Unset; type Platform = Unset; - } - ///State transition - sets the `token` field to Set - pub struct SetToken(PhantomData S>); - impl sealed::Sealed for SetToken {} - impl State for SetToken { - type Token = Set; - type AppId = S::AppId; - type ServiceDid = S::ServiceDid; - type Platform = S::Platform; - } - ///State transition - sets the `app_id` field to Set - pub struct SetAppId(PhantomData S>); - impl sealed::Sealed for SetAppId {} - impl State for SetAppId { - type Token = S::Token; - type AppId = Set; - type ServiceDid = S::ServiceDid; - type Platform = S::Platform; + type AppId = Unset; + type Token = Unset; } ///State transition - sets the `service_did` field to Set pub struct SetServiceDid(PhantomData S>); impl sealed::Sealed for SetServiceDid {} impl State for SetServiceDid { - type Token = S::Token; - type AppId = S::AppId; type ServiceDid = Set; type Platform = S::Platform; + type AppId = S::AppId; + type Token = S::Token; } ///State transition - sets the `platform` field to Set pub struct SetPlatform(PhantomData S>); impl sealed::Sealed for SetPlatform {} impl State for SetPlatform { - type Token = S::Token; - type AppId = S::AppId; type ServiceDid = S::ServiceDid; type Platform = Set; + type AppId = S::AppId; + type Token = S::Token; + } + ///State transition - sets the `app_id` field to Set + pub struct SetAppId(PhantomData S>); + impl sealed::Sealed for SetAppId {} + impl State for SetAppId { + type ServiceDid = S::ServiceDid; + type Platform = S::Platform; + type AppId = Set; + type Token = S::Token; + } + ///State transition - sets the `token` field to Set + pub struct SetToken(PhantomData S>); + impl sealed::Sealed for SetToken {} + impl State for SetToken { + type ServiceDid = S::ServiceDid; + type Platform = S::Platform; + type AppId = S::AppId; + type Token = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `token` field - pub struct token(()); - ///Marker type for the `app_id` field - pub struct app_id(()); ///Marker type for the `service_did` field pub struct service_did(()); ///Marker type for the `platform` field pub struct platform(()); + ///Marker type for the `app_id` field + pub struct app_id(()); + ///Marker type for the `token` field + pub struct token(()); } } @@ -106,7 +106,7 @@ pub struct UnregisterPushBuilder<'a, S: unregister_push_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), @@ -158,7 +158,7 @@ where /// Set the `platform` field (required) pub fn platform( mut self, - value: impl Into>, + value: impl Into>, ) -> UnregisterPushBuilder<'a, unregister_push_state::SetPlatform> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); UnregisterPushBuilder { @@ -210,10 +210,10 @@ where impl<'a, S> UnregisterPushBuilder<'a, S> where S: unregister_push_state::State, - S::Token: unregister_push_state::IsSet, - S::AppId: unregister_push_state::IsSet, S::ServiceDid: unregister_push_state::IsSet, S::Platform: unregister_push_state::IsSet, + S::AppId: unregister_push_state::IsSet, + S::Token: unregister_push_state::IsSet, { /// Build the final struct pub fn build(self) -> UnregisterPush<'a> { @@ -243,6 +243,101 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UnregisterPushPlatform<'a> { + Ios, + Android, + Web, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UnregisterPushPlatform<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Ios => "ios", + Self::Android => "android", + Self::Web => "web", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UnregisterPushPlatform<'a> { + fn from(s: &'a str) -> Self { + match s { + "ios" => Self::Ios, + "android" => Self::Android, + "web" => Self::Web, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UnregisterPushPlatform<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "ios" => Self::Ios, + "android" => Self::Android, + "web" => Self::Web, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UnregisterPushPlatform<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UnregisterPushPlatform<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UnregisterPushPlatform<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UnregisterPushPlatform<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UnregisterPushPlatform<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UnregisterPushPlatform<'_> { + type Output = UnregisterPushPlatform<'static>; + fn into_static(self) -> Self::Output { + match self { + UnregisterPushPlatform::Ios => UnregisterPushPlatform::Ios, + UnregisterPushPlatform::Android => UnregisterPushPlatform::Android, + UnregisterPushPlatform::Web => UnregisterPushPlatform::Web, + UnregisterPushPlatform::Other(v) => { + UnregisterPushPlatform::Other(v.into_static()) + } + } + } +} + /// Response type for ///app.bsky.notification.unregisterPush pub struct UnregisterPushResponse; diff --git a/crates/weaver-api/src/app_bsky/richtext/facet.rs b/crates/weaver-api/src/app_bsky/richtext/facet.rs index aeae106..97f3cdb 100644 --- a/crates/weaver-api/src/app_bsky/richtext/facet.rs +++ b/crates/weaver-api/src/app_bsky/richtext/facet.rs @@ -32,37 +32,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteEnd; type ByteStart; + type ByteEnd; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteEnd = Unset; type ByteStart = Unset; - } - ///State transition - sets the `byte_end` field to Set - pub struct SetByteEnd(PhantomData S>); - impl sealed::Sealed for SetByteEnd {} - impl State for SetByteEnd { - type ByteEnd = Set; - type ByteStart = S::ByteStart; + type ByteEnd = Unset; } ///State transition - sets the `byte_start` field to Set pub struct SetByteStart(PhantomData S>); impl sealed::Sealed for SetByteStart {} impl State for SetByteStart { - type ByteEnd = S::ByteEnd; type ByteStart = Set; + type ByteEnd = S::ByteEnd; + } + ///State transition - sets the `byte_end` field to Set + pub struct SetByteEnd(PhantomData S>); + impl sealed::Sealed for SetByteEnd {} + impl State for SetByteEnd { + type ByteStart = S::ByteStart; + type ByteEnd = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_end` field - pub struct byte_end(()); ///Marker type for the `byte_start` field pub struct byte_start(()); + ///Marker type for the `byte_end` field + pub struct byte_end(()); } } @@ -132,8 +132,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteEnd: byte_slice_state::IsSet, S::ByteStart: byte_slice_state::IsSet, + S::ByteEnd: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -168,7 +168,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteSlice"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -229,7 +229,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -268,7 +268,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("features"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -311,7 +311,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -347,7 +347,7 @@ fn lexicon_doc_app_bsky_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("tag"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -384,7 +384,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.byte_end; if *value < 0i64 { @@ -547,7 +547,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -581,37 +581,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Index; type Features; + type Index; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Index = Unset; type Features = Unset; - } - ///State transition - sets the `index` field to Set - pub struct SetIndex(PhantomData S>); - impl sealed::Sealed for SetIndex {} - impl State for SetIndex { - type Index = Set; - type Features = S::Features; + type Index = Unset; } ///State transition - sets the `features` field to Set pub struct SetFeatures(PhantomData S>); impl sealed::Sealed for SetFeatures {} impl State for SetFeatures { - type Index = S::Index; type Features = Set; + type Index = S::Index; + } + ///State transition - sets the `index` field to Set + pub struct SetIndex(PhantomData S>); + impl sealed::Sealed for SetIndex {} + impl State for SetIndex { + type Features = S::Features; + type Index = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `index` field - pub struct index(()); ///Marker type for the `features` field pub struct features(()); + ///Marker type for the `index` field + pub struct index(()); } } @@ -684,8 +684,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Index: facet_state::IsSet, S::Features: facet_state::IsSet, + S::Index: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { @@ -744,7 +744,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -883,7 +883,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Mention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -918,7 +918,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Tag<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.tag; #[allow(unused_comparisons)] diff --git a/crates/weaver-api/src/app_bsky/unspecced.rs b/crates/weaver-api/src/app_bsky/unspecced.rs index a8d304f..56cf118 100644 --- a/crates/weaver-api/src/app_bsky/unspecced.rs +++ b/crates/weaver-api/src/app_bsky/unspecced.rs @@ -68,7 +68,7 @@ pub struct AgeAssuranceEvent<'a> { pub init_ua: std::option::Option>, /// The status of the age assurance process. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: AgeAssuranceEventStatus<'a>, } pub mod age_assurance_event_state { @@ -81,49 +81,49 @@ pub mod age_assurance_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type AttemptId; + type Status; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type AttemptId = Unset; + type Status = Unset; type CreatedAt = Unset; } - ///State transition - sets the `status` field to Set - pub struct SetStatus(PhantomData S>); - impl sealed::Sealed for SetStatus {} - impl State for SetStatus { - type Status = Set; - type AttemptId = S::AttemptId; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `attempt_id` field to Set pub struct SetAttemptId(PhantomData S>); impl sealed::Sealed for SetAttemptId {} impl State for SetAttemptId { - type Status = S::Status; type AttemptId = Set; + type Status = S::Status; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus(PhantomData S>); + impl sealed::Sealed for SetStatus {} + impl State for SetStatus { + type AttemptId = S::AttemptId; + type Status = Set; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Status = S::Status; type AttemptId = S::AttemptId; + type Status = S::Status; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `attempt_id` field pub struct attempt_id(()); + ///Marker type for the `status` field + pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -140,7 +140,7 @@ pub struct AgeAssuranceEventBuilder<'a, S: age_assurance_event_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -295,7 +295,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> AgeAssuranceEventBuilder<'a, age_assurance_event_state::SetStatus> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); AgeAssuranceEventBuilder { @@ -309,8 +309,8 @@ where impl<'a, S> AgeAssuranceEventBuilder<'a, S> where S: age_assurance_event_state::State, - S::Status: age_assurance_event_state::IsSet, S::AttemptId: age_assurance_event_state::IsSet, + S::Status: age_assurance_event_state::IsSet, S::CreatedAt: age_assurance_event_state::IsSet, { /// Build the final struct @@ -349,6 +349,102 @@ where } } +/// The status of the age assurance process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AgeAssuranceEventStatus<'a> { + Unknown, + Pending, + Assured, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AgeAssuranceEventStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::Pending => "pending", + Self::Assured => "assured", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AgeAssuranceEventStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AgeAssuranceEventStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AgeAssuranceEventStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AgeAssuranceEventStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AgeAssuranceEventStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AgeAssuranceEventStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AgeAssuranceEventStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AgeAssuranceEventStatus<'_> { + type Output = AgeAssuranceEventStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AgeAssuranceEventStatus::Unknown => AgeAssuranceEventStatus::Unknown, + AgeAssuranceEventStatus::Pending => AgeAssuranceEventStatus::Pending, + AgeAssuranceEventStatus::Assured => AgeAssuranceEventStatus::Assured, + AgeAssuranceEventStatus::Other(v) => { + AgeAssuranceEventStatus::Other(v.into_static()) + } + } + } +} + fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -358,7 +454,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("ageAssuranceEvent"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -377,7 +473,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "attemptId", @@ -558,7 +654,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "lastInitiatedAt", @@ -615,7 +711,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -647,7 +743,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -681,7 +777,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -720,7 +816,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("category"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -866,7 +962,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -890,7 +986,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -903,7 +999,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -925,7 +1021,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hiddenByThreadgate", @@ -1007,7 +1103,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -1148,7 +1244,7 @@ fn lexicon_doc_app_bsky_unspecced_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -1234,7 +1330,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1258,7 +1354,108 @@ pub struct AgeAssuranceState<'a> { pub last_initiated_at: std::option::Option, /// The status of the age assurance process. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: AgeAssuranceStateStatus<'a>, +} + +/// The status of the age assurance process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AgeAssuranceStateStatus<'a> { + Unknown, + Pending, + Assured, + Blocked, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AgeAssuranceStateStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::Pending => "pending", + Self::Assured => "assured", + Self::Blocked => "blocked", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AgeAssuranceStateStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AgeAssuranceStateStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AgeAssuranceStateStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AgeAssuranceStateStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AgeAssuranceStateStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AgeAssuranceStateStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AgeAssuranceStateStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AgeAssuranceStateStatus<'_> { + type Output = AgeAssuranceStateStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AgeAssuranceStateStatus::Unknown => AgeAssuranceStateStatus::Unknown, + AgeAssuranceStateStatus::Pending => AgeAssuranceStateStatus::Pending, + AgeAssuranceStateStatus::Assured => AgeAssuranceStateStatus::Assured, + AgeAssuranceStateStatus::Blocked => AgeAssuranceStateStatus::Blocked, + AgeAssuranceStateStatus::Other(v) => { + AgeAssuranceStateStatus::Other(v.into_static()) + } + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceState<'a> { @@ -1273,7 +1470,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1411,7 +1608,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonSearchActor<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1549,7 +1746,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonSearchPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1698,7 +1895,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonSearchStarterPack } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1728,7 +1925,7 @@ pub struct SkeletonTrend<'a> { pub started_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, #[serde(borrow)] pub topic: jacquard_common::CowStr<'a>, } @@ -1743,105 +1940,105 @@ pub mod skeleton_trend_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type StartedAt; + type DisplayName; type Link; - type Dids; type Topic; - type DisplayName; + type Dids; type PostCount; + type StartedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type StartedAt = Unset; + type DisplayName = Unset; type Link = Unset; - type Dids = Unset; type Topic = Unset; - type DisplayName = Unset; + type Dids = Unset; type PostCount = Unset; + type StartedAt = Unset; } - ///State transition - sets the `started_at` field to Set - pub struct SetStartedAt(PhantomData S>); - impl sealed::Sealed for SetStartedAt {} - impl State for SetStartedAt { - type StartedAt = Set; + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName(PhantomData S>); + impl sealed::Sealed for SetDisplayName {} + impl State for SetDisplayName { + type DisplayName = Set; type Link = S::Link; - type Dids = S::Dids; type Topic = S::Topic; - type DisplayName = S::DisplayName; + type Dids = S::Dids; type PostCount = S::PostCount; + type StartedAt = S::StartedAt; } ///State transition - sets the `link` field to Set pub struct SetLink(PhantomData S>); impl sealed::Sealed for SetLink {} impl State for SetLink { - type StartedAt = S::StartedAt; + type DisplayName = S::DisplayName; type Link = Set; - type Dids = S::Dids; type Topic = S::Topic; - type DisplayName = S::DisplayName; + type Dids = S::Dids; type PostCount = S::PostCount; - } - ///State transition - sets the `dids` field to Set - pub struct SetDids(PhantomData S>); - impl sealed::Sealed for SetDids {} - impl State for SetDids { type StartedAt = S::StartedAt; - type Link = S::Link; - type Dids = Set; - type Topic = S::Topic; - type DisplayName = S::DisplayName; - type PostCount = S::PostCount; } ///State transition - sets the `topic` field to Set pub struct SetTopic(PhantomData S>); impl sealed::Sealed for SetTopic {} impl State for SetTopic { - type StartedAt = S::StartedAt; + type DisplayName = S::DisplayName; type Link = S::Link; - type Dids = S::Dids; type Topic = Set; - type DisplayName = S::DisplayName; + type Dids = S::Dids; type PostCount = S::PostCount; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName(PhantomData S>); - impl sealed::Sealed for SetDisplayName {} - impl State for SetDisplayName { type StartedAt = S::StartedAt; + } + ///State transition - sets the `dids` field to Set + pub struct SetDids(PhantomData S>); + impl sealed::Sealed for SetDids {} + impl State for SetDids { + type DisplayName = S::DisplayName; type Link = S::Link; - type Dids = S::Dids; type Topic = S::Topic; - type DisplayName = Set; + type Dids = Set; type PostCount = S::PostCount; + type StartedAt = S::StartedAt; } ///State transition - sets the `post_count` field to Set pub struct SetPostCount(PhantomData S>); impl sealed::Sealed for SetPostCount {} impl State for SetPostCount { - type StartedAt = S::StartedAt; + type DisplayName = S::DisplayName; type Link = S::Link; - type Dids = S::Dids; type Topic = S::Topic; - type DisplayName = S::DisplayName; + type Dids = S::Dids; type PostCount = Set; + type StartedAt = S::StartedAt; + } + ///State transition - sets the `started_at` field to Set + pub struct SetStartedAt(PhantomData S>); + impl sealed::Sealed for SetStartedAt {} + impl State for SetStartedAt { + type DisplayName = S::DisplayName; + type Link = S::Link; + type Topic = S::Topic; + type Dids = S::Dids; + type PostCount = S::PostCount; + type StartedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `started_at` field - pub struct started_at(()); + ///Marker type for the `display_name` field + pub struct display_name(()); ///Marker type for the `link` field pub struct link(()); - ///Marker type for the `dids` field - pub struct dids(()); ///Marker type for the `topic` field pub struct topic(()); - ///Marker type for the `display_name` field - pub struct display_name(()); + ///Marker type for the `dids` field + pub struct dids(()); ///Marker type for the `post_count` field pub struct post_count(()); + ///Marker type for the `started_at` field + pub struct started_at(()); } } @@ -1855,7 +2052,7 @@ pub struct SkeletonTrendBuilder<'a, S: skeleton_trend_state::State> { ::core::option::Option>, ::core::option::Option, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -1992,15 +2189,12 @@ where impl<'a, S: skeleton_trend_state::State> SkeletonTrendBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.6 = value; self } @@ -2028,12 +2222,12 @@ where impl<'a, S> SkeletonTrendBuilder<'a, S> where S: skeleton_trend_state::State, - S::StartedAt: skeleton_trend_state::IsSet, + S::DisplayName: skeleton_trend_state::IsSet, S::Link: skeleton_trend_state::IsSet, - S::Dids: skeleton_trend_state::IsSet, S::Topic: skeleton_trend_state::IsSet, - S::DisplayName: skeleton_trend_state::IsSet, + S::Dids: skeleton_trend_state::IsSet, S::PostCount: skeleton_trend_state::IsSet, + S::StartedAt: skeleton_trend_state::IsSet, { /// Build the final struct pub fn build(self) -> SkeletonTrend<'a> { @@ -2071,6 +2265,89 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SkeletonTrendStatus<'a> { + Hot, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SkeletonTrendStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Hot => "hot", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SkeletonTrendStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "hot" => Self::Hot, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SkeletonTrendStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "hot" => Self::Hot, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SkeletonTrendStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SkeletonTrendStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SkeletonTrendStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SkeletonTrendStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SkeletonTrendStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SkeletonTrendStatus<'_> { + type Output = SkeletonTrendStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + SkeletonTrendStatus::Hot => SkeletonTrendStatus::Hot, + SkeletonTrendStatus::Other(v) => SkeletonTrendStatus::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonTrend<'a> { fn nsid() -> &'static str { "app.bsky.unspecced.defs" @@ -2083,7 +2360,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SkeletonTrend<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2221,7 +2498,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItemBlocked<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2251,7 +2528,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItemNoUnauthenticat } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2281,7 +2558,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItemNotFound<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2322,10 +2599,10 @@ pub mod thread_item_post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Post; type MoreParents; - type OpThread; type MoreReplies; - type Post; + type OpThread; type HiddenByThreadgate; type MutedByViewer; } @@ -2333,32 +2610,32 @@ pub mod thread_item_post_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Post = Unset; type MoreParents = Unset; - type OpThread = Unset; type MoreReplies = Unset; - type Post = Unset; + type OpThread = Unset; type HiddenByThreadgate = Unset; type MutedByViewer = Unset; } + ///State transition - sets the `post` field to Set + pub struct SetPost(PhantomData S>); + impl sealed::Sealed for SetPost {} + impl State for SetPost { + type Post = Set; + type MoreParents = S::MoreParents; + type MoreReplies = S::MoreReplies; + type OpThread = S::OpThread; + type HiddenByThreadgate = S::HiddenByThreadgate; + type MutedByViewer = S::MutedByViewer; + } ///State transition - sets the `more_parents` field to Set pub struct SetMoreParents(PhantomData S>); impl sealed::Sealed for SetMoreParents {} impl State for SetMoreParents { - type MoreParents = Set; - type OpThread = S::OpThread; - type MoreReplies = S::MoreReplies; type Post = S::Post; - type HiddenByThreadgate = S::HiddenByThreadgate; - type MutedByViewer = S::MutedByViewer; - } - ///State transition - sets the `op_thread` field to Set - pub struct SetOpThread(PhantomData S>); - impl sealed::Sealed for SetOpThread {} - impl State for SetOpThread { - type MoreParents = S::MoreParents; - type OpThread = Set; + type MoreParents = Set; type MoreReplies = S::MoreReplies; - type Post = S::Post; + type OpThread = S::OpThread; type HiddenByThreadgate = S::HiddenByThreadgate; type MutedByViewer = S::MutedByViewer; } @@ -2366,21 +2643,21 @@ pub mod thread_item_post_state { pub struct SetMoreReplies(PhantomData S>); impl sealed::Sealed for SetMoreReplies {} impl State for SetMoreReplies { + type Post = S::Post; type MoreParents = S::MoreParents; - type OpThread = S::OpThread; type MoreReplies = Set; - type Post = S::Post; + type OpThread = S::OpThread; type HiddenByThreadgate = S::HiddenByThreadgate; type MutedByViewer = S::MutedByViewer; } - ///State transition - sets the `post` field to Set - pub struct SetPost(PhantomData S>); - impl sealed::Sealed for SetPost {} - impl State for SetPost { + ///State transition - sets the `op_thread` field to Set + pub struct SetOpThread(PhantomData S>); + impl sealed::Sealed for SetOpThread {} + impl State for SetOpThread { + type Post = S::Post; type MoreParents = S::MoreParents; - type OpThread = S::OpThread; type MoreReplies = S::MoreReplies; - type Post = Set; + type OpThread = Set; type HiddenByThreadgate = S::HiddenByThreadgate; type MutedByViewer = S::MutedByViewer; } @@ -2388,10 +2665,10 @@ pub mod thread_item_post_state { pub struct SetHiddenByThreadgate(PhantomData S>); impl sealed::Sealed for SetHiddenByThreadgate {} impl State for SetHiddenByThreadgate { + type Post = S::Post; type MoreParents = S::MoreParents; - type OpThread = S::OpThread; type MoreReplies = S::MoreReplies; - type Post = S::Post; + type OpThread = S::OpThread; type HiddenByThreadgate = Set; type MutedByViewer = S::MutedByViewer; } @@ -2399,24 +2676,24 @@ pub mod thread_item_post_state { pub struct SetMutedByViewer(PhantomData S>); impl sealed::Sealed for SetMutedByViewer {} impl State for SetMutedByViewer { + type Post = S::Post; type MoreParents = S::MoreParents; - type OpThread = S::OpThread; type MoreReplies = S::MoreReplies; - type Post = S::Post; + type OpThread = S::OpThread; type HiddenByThreadgate = S::HiddenByThreadgate; type MutedByViewer = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `post` field + pub struct post(()); ///Marker type for the `more_parents` field pub struct more_parents(()); - ///Marker type for the `op_thread` field - pub struct op_thread(()); ///Marker type for the `more_replies` field pub struct more_replies(()); - ///Marker type for the `post` field - pub struct post(()); + ///Marker type for the `op_thread` field + pub struct op_thread(()); ///Marker type for the `hidden_by_threadgate` field pub struct hidden_by_threadgate(()); ///Marker type for the `muted_by_viewer` field @@ -2573,10 +2850,10 @@ where impl<'a, S> ThreadItemPostBuilder<'a, S> where S: thread_item_post_state::State, + S::Post: thread_item_post_state::IsSet, S::MoreParents: thread_item_post_state::IsSet, - S::OpThread: thread_item_post_state::IsSet, S::MoreReplies: thread_item_post_state::IsSet, - S::Post: thread_item_post_state::IsSet, + S::OpThread: thread_item_post_state::IsSet, S::HiddenByThreadgate: thread_item_post_state::IsSet, S::MutedByViewer: thread_item_post_state::IsSet, { @@ -2624,7 +2901,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItemPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2654,7 +2931,7 @@ pub struct TrendView<'a> { pub started_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, #[serde(borrow)] pub topic: jacquard_common::CowStr<'a>, } @@ -2670,104 +2947,104 @@ pub mod trend_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Topic; - type StartedAt; - type PostCount; type DisplayName; - type Actors; type Link; + type PostCount; + type Actors; + type StartedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Topic = Unset; - type StartedAt = Unset; - type PostCount = Unset; type DisplayName = Unset; - type Actors = Unset; type Link = Unset; + type PostCount = Unset; + type Actors = Unset; + type StartedAt = Unset; } ///State transition - sets the `topic` field to Set pub struct SetTopic(PhantomData S>); impl sealed::Sealed for SetTopic {} impl State for SetTopic { type Topic = Set; - type StartedAt = S::StartedAt; - type PostCount = S::PostCount; type DisplayName = S::DisplayName; - type Actors = S::Actors; type Link = S::Link; + type PostCount = S::PostCount; + type Actors = S::Actors; + type StartedAt = S::StartedAt; } - ///State transition - sets the `started_at` field to Set - pub struct SetStartedAt(PhantomData S>); - impl sealed::Sealed for SetStartedAt {} - impl State for SetStartedAt { + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName(PhantomData S>); + impl sealed::Sealed for SetDisplayName {} + impl State for SetDisplayName { type Topic = S::Topic; - type StartedAt = Set; + type DisplayName = Set; + type Link = S::Link; type PostCount = S::PostCount; + type Actors = S::Actors; + type StartedAt = S::StartedAt; + } + ///State transition - sets the `link` field to Set + pub struct SetLink(PhantomData S>); + impl sealed::Sealed for SetLink {} + impl State for SetLink { + type Topic = S::Topic; type DisplayName = S::DisplayName; + type Link = Set; + type PostCount = S::PostCount; type Actors = S::Actors; - type Link = S::Link; + type StartedAt = S::StartedAt; } ///State transition - sets the `post_count` field to Set pub struct SetPostCount(PhantomData S>); impl sealed::Sealed for SetPostCount {} impl State for SetPostCount { type Topic = S::Topic; - type StartedAt = S::StartedAt; - type PostCount = Set; type DisplayName = S::DisplayName; - type Actors = S::Actors; type Link = S::Link; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName(PhantomData S>); - impl sealed::Sealed for SetDisplayName {} - impl State for SetDisplayName { - type Topic = S::Topic; - type StartedAt = S::StartedAt; - type PostCount = S::PostCount; - type DisplayName = Set; + type PostCount = Set; type Actors = S::Actors; - type Link = S::Link; + type StartedAt = S::StartedAt; } ///State transition - sets the `actors` field to Set pub struct SetActors(PhantomData S>); impl sealed::Sealed for SetActors {} impl State for SetActors { type Topic = S::Topic; - type StartedAt = S::StartedAt; - type PostCount = S::PostCount; type DisplayName = S::DisplayName; - type Actors = Set; type Link = S::Link; + type PostCount = S::PostCount; + type Actors = Set; + type StartedAt = S::StartedAt; } - ///State transition - sets the `link` field to Set - pub struct SetLink(PhantomData S>); - impl sealed::Sealed for SetLink {} - impl State for SetLink { + ///State transition - sets the `started_at` field to Set + pub struct SetStartedAt(PhantomData S>); + impl sealed::Sealed for SetStartedAt {} + impl State for SetStartedAt { type Topic = S::Topic; - type StartedAt = S::StartedAt; - type PostCount = S::PostCount; type DisplayName = S::DisplayName; + type Link = S::Link; + type PostCount = S::PostCount; type Actors = S::Actors; - type Link = Set; + type StartedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `topic` field pub struct topic(()); - ///Marker type for the `started_at` field - pub struct started_at(()); - ///Marker type for the `post_count` field - pub struct post_count(()); ///Marker type for the `display_name` field pub struct display_name(()); - ///Marker type for the `actors` field - pub struct actors(()); ///Marker type for the `link` field pub struct link(()); + ///Marker type for the `post_count` field + pub struct post_count(()); + ///Marker type for the `actors` field + pub struct actors(()); + ///Marker type for the `started_at` field + pub struct started_at(()); } } @@ -2781,7 +3058,7 @@ pub struct TrendViewBuilder<'a, S: trend_view_state::State> { ::core::option::Option>, ::core::option::Option, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -2918,15 +3195,12 @@ where impl<'a, S: trend_view_state::State> TrendViewBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.6 = value; self } @@ -2955,11 +3229,11 @@ impl<'a, S> TrendViewBuilder<'a, S> where S: trend_view_state::State, S::Topic: trend_view_state::IsSet, - S::StartedAt: trend_view_state::IsSet, - S::PostCount: trend_view_state::IsSet, S::DisplayName: trend_view_state::IsSet, - S::Actors: trend_view_state::IsSet, S::Link: trend_view_state::IsSet, + S::PostCount: trend_view_state::IsSet, + S::Actors: trend_view_state::IsSet, + S::StartedAt: trend_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TrendView<'a> { @@ -2997,6 +3271,89 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum TrendViewStatus<'a> { + Hot, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> TrendViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Hot => "hot", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for TrendViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "hot" => Self::Hot, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for TrendViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "hot" => Self::Hot, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for TrendViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for TrendViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for TrendViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for TrendViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for TrendViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for TrendViewStatus<'_> { + type Output = TrendViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + TrendViewStatus::Hot => TrendViewStatus::Hot, + TrendViewStatus::Other(v) => TrendViewStatus::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TrendView<'a> { fn nsid() -> &'static str { "app.bsky.unspecced.defs" @@ -3009,7 +3366,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TrendView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3051,7 +3408,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TrendingTopic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/unspecced/get_config.rs b/crates/weaver-api/src/app_bsky/unspecced/get_config.rs index 08bdc64..1cb09d3 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/get_config.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/get_config.rs @@ -33,37 +33,37 @@ pub mod live_now_config_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Domains; type Did; + type Domains; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Domains = Unset; type Did = Unset; - } - ///State transition - sets the `domains` field to Set - pub struct SetDomains(PhantomData S>); - impl sealed::Sealed for SetDomains {} - impl State for SetDomains { - type Domains = Set; - type Did = S::Did; + type Domains = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Domains = S::Domains; type Did = Set; + type Domains = S::Domains; + } + ///State transition - sets the `domains` field to Set + pub struct SetDomains(PhantomData S>); + impl sealed::Sealed for SetDomains {} + impl State for SetDomains { + type Did = S::Did; + type Domains = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `domains` field - pub struct domains(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `domains` field + pub struct domains(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> LiveNowConfigBuilder<'a, S> where S: live_now_config_state::State, - S::Domains: live_now_config_state::IsSet, S::Did: live_now_config_state::IsSet, + S::Domains: live_now_config_state::IsSet, { /// Build the final struct pub fn build(self) -> LiveNowConfig<'a> { @@ -172,7 +172,7 @@ fn lexicon_doc_app_bsky_unspecced_getConfig() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("liveNowConfig"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_app_bsky_unspecced_getConfig() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -254,7 +254,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LiveNowConfig<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs b/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs index 691dc9b..95c8e55 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs @@ -190,50 +190,50 @@ pub mod thread_item_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; - type Depth; type Value; + type Depth; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; - type Depth = Unset; type Value = Unset; + type Depth = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Uri = Set; - type Depth = S::Depth; - type Value = S::Value; - } - ///State transition - sets the `depth` field to Set - pub struct SetDepth(PhantomData S>); - impl sealed::Sealed for SetDepth {} - impl State for SetDepth { - type Uri = S::Uri; - type Depth = Set; type Value = S::Value; + type Depth = S::Depth; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { type Uri = S::Uri; - type Depth = S::Depth; type Value = Set; + type Depth = S::Depth; + } + ///State transition - sets the `depth` field to Set + pub struct SetDepth(PhantomData S>); + impl sealed::Sealed for SetDepth {} + impl State for SetDepth { + type Uri = S::Uri; + type Value = S::Value; + type Depth = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `depth` field - pub struct depth(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `depth` field + pub struct depth(()); } } @@ -327,8 +327,8 @@ impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Uri: thread_item_state::IsSet, - S::Depth: thread_item_state::IsSet, S::Value: thread_item_state::IsSet, + S::Depth: thread_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItem<'a> { @@ -367,7 +367,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadOtherV2() -> ::jacquard_lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -382,7 +382,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadOtherV2() -> ::jacquard_lexicon:: ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("anchor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -426,7 +426,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadOtherV2() -> ::jacquard_lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("depth"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -486,7 +486,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_v2.rs b/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_v2.rs index 7f475f3..d598876 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_v2.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/get_post_thread_v2.rs @@ -266,50 +266,50 @@ pub mod thread_item_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; - type Value; type Depth; + type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; - type Value = Unset; type Depth = Unset; + type Value = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Uri = Set; - type Value = S::Value; - type Depth = S::Depth; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { - type Uri = S::Uri; - type Value = Set; type Depth = S::Depth; + type Value = S::Value; } ///State transition - sets the `depth` field to Set pub struct SetDepth(PhantomData S>); impl sealed::Sealed for SetDepth {} impl State for SetDepth { type Uri = S::Uri; - type Value = S::Value; type Depth = Set; + type Value = S::Value; + } + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Uri = S::Uri; + type Depth = S::Depth; + type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `depth` field pub struct depth(()); + ///Marker type for the `value` field + pub struct value(()); } } @@ -403,8 +403,8 @@ impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Uri: thread_item_state::IsSet, - S::Value: thread_item_state::IsSet, S::Depth: thread_item_state::IsSet, + S::Value: thread_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItem<'a> { @@ -466,7 +466,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadV2() -> ::jacquard_lexicon::lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -481,7 +481,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadV2() -> ::jacquard_lexicon::lexic ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("above"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -576,7 +576,7 @@ fn lexicon_doc_app_bsky_unspecced_getPostThreadV2() -> ::jacquard_lexicon::lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("depth"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -639,7 +639,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/unspecced/get_tagged_suggestions.rs b/crates/weaver-api/src/app_bsky/unspecced/get_tagged_suggestions.rs index c7e465a..4f6a7f7 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/get_tagged_suggestions.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/get_tagged_suggestions.rs @@ -75,7 +75,7 @@ pub struct Suggestion<'a> { #[serde(borrow)] pub subject: jacquard_common::types::string::Uri<'a>, #[serde(borrow)] - pub subject_type: jacquard_common::CowStr<'a>, + pub subject_type: SuggestionSubjectType<'a>, #[serde(borrow)] pub tag: jacquard_common::CowStr<'a>, } @@ -90,51 +90,51 @@ pub mod suggestion_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Tag; type SubjectType; type Subject; - type Tag; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Tag = Unset; type SubjectType = Unset; type Subject = Unset; - type Tag = Unset; + } + ///State transition - sets the `tag` field to Set + pub struct SetTag(PhantomData S>); + impl sealed::Sealed for SetTag {} + impl State for SetTag { + type Tag = Set; + type SubjectType = S::SubjectType; + type Subject = S::Subject; } ///State transition - sets the `subject_type` field to Set pub struct SetSubjectType(PhantomData S>); impl sealed::Sealed for SetSubjectType {} impl State for SetSubjectType { + type Tag = S::Tag; type SubjectType = Set; type Subject = S::Subject; - type Tag = S::Tag; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type SubjectType = S::SubjectType; - type Subject = Set; type Tag = S::Tag; - } - ///State transition - sets the `tag` field to Set - pub struct SetTag(PhantomData S>); - impl sealed::Sealed for SetTag {} - impl State for SetTag { type SubjectType = S::SubjectType; - type Subject = S::Subject; - type Tag = Set; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `tag` field + pub struct tag(()); ///Marker type for the `subject_type` field pub struct subject_type(()); ///Marker type for the `subject` field pub struct subject(()); - ///Marker type for the `tag` field - pub struct tag(()); } } @@ -143,7 +143,7 @@ pub struct SuggestionBuilder<'a, S: suggestion_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -194,7 +194,7 @@ where /// Set the `subjectType` field (required) pub fn subject_type( mut self, - value: impl Into>, + value: impl Into>, ) -> SuggestionBuilder<'a, suggestion_state::SetSubjectType> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); SuggestionBuilder { @@ -227,9 +227,9 @@ where impl<'a, S> SuggestionBuilder<'a, S> where S: suggestion_state::State, + S::Tag: suggestion_state::IsSet, S::SubjectType: suggestion_state::IsSet, S::Subject: suggestion_state::IsSet, - S::Tag: suggestion_state::IsSet, { /// Build the final struct pub fn build(self) -> Suggestion<'a> { @@ -257,6 +257,96 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SuggestionSubjectType<'a> { + Actor, + Feed, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SuggestionSubjectType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Actor => "actor", + Self::Feed => "feed", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SuggestionSubjectType<'a> { + fn from(s: &'a str) -> Self { + match s { + "actor" => Self::Actor, + "feed" => Self::Feed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SuggestionSubjectType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "actor" => Self::Actor, + "feed" => Self::Feed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SuggestionSubjectType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SuggestionSubjectType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SuggestionSubjectType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SuggestionSubjectType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SuggestionSubjectType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SuggestionSubjectType<'_> { + type Output = SuggestionSubjectType<'static>; + fn into_static(self) -> Self::Output { + match self { + SuggestionSubjectType::Actor => SuggestionSubjectType::Actor, + SuggestionSubjectType::Feed => SuggestionSubjectType::Feed, + SuggestionSubjectType::Other(v) => { + SuggestionSubjectType::Other(v.into_static()) + } + } + } +} + fn lexicon_doc_app_bsky_unspecced_getTaggedSuggestions() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -268,7 +358,7 @@ fn lexicon_doc_app_bsky_unspecced_getTaggedSuggestions() -> ::jacquard_lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -279,7 +369,7 @@ fn lexicon_doc_app_bsky_unspecced_getTaggedSuggestions() -> ::jacquard_lexicon:: required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -302,7 +392,7 @@ fn lexicon_doc_app_bsky_unspecced_getTaggedSuggestions() -> ::jacquard_lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -373,7 +463,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Suggestion<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/app_bsky/unspecced/init_age_assurance.rs b/crates/weaver-api/src/app_bsky/unspecced/init_age_assurance.rs index 074d2dd..58670e4 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/init_age_assurance.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/init_age_assurance.rs @@ -69,8 +69,8 @@ pub enum InitAgeAssuranceError<'a> { InvalidInitiation(std::option::Option>), } -impl std::fmt::Display for InitAgeAssuranceError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for InitAgeAssuranceError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidEmail(msg) => { write!(f, "InvalidEmail")?; diff --git a/crates/weaver-api/src/app_bsky/unspecced/search_actors_skeleton.rs b/crates/weaver-api/src/app_bsky/unspecced/search_actors_skeleton.rs index d2fadf8..4e794b5 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/search_actors_skeleton.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/search_actors_skeleton.rs @@ -235,8 +235,8 @@ pub enum SearchActorsSkeletonError<'a> { BadQueryString(std::option::Option>), } -impl std::fmt::Display for SearchActorsSkeletonError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SearchActorsSkeletonError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BadQueryString(msg) => { write!(f, "BadQueryString")?; diff --git a/crates/weaver-api/src/app_bsky/unspecced/search_posts_skeleton.rs b/crates/weaver-api/src/app_bsky/unspecced/search_posts_skeleton.rs index e873d02..64dbf44 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/search_posts_skeleton.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/search_posts_skeleton.rs @@ -430,8 +430,8 @@ pub enum SearchPostsSkeletonError<'a> { BadQueryString(std::option::Option>), } -impl std::fmt::Display for SearchPostsSkeletonError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SearchPostsSkeletonError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BadQueryString(msg) => { write!(f, "BadQueryString")?; diff --git a/crates/weaver-api/src/app_bsky/unspecced/search_starter_packs_skeleton.rs b/crates/weaver-api/src/app_bsky/unspecced/search_starter_packs_skeleton.rs index b7479b6..aec865a 100644 --- a/crates/weaver-api/src/app_bsky/unspecced/search_starter_packs_skeleton.rs +++ b/crates/weaver-api/src/app_bsky/unspecced/search_starter_packs_skeleton.rs @@ -235,8 +235,8 @@ pub enum SearchStarterPacksSkeletonError<'a> { BadQueryString(std::option::Option>), } -impl std::fmt::Display for SearchStarterPacksSkeletonError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SearchStarterPacksSkeletonError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BadQueryString(msg) => { write!(f, "BadQueryString")?; diff --git a/crates/weaver-api/src/app_bsky/video.rs b/crates/weaver-api/src/app_bsky/video.rs index d223271..6fe37df 100644 --- a/crates/weaver-api/src/app_bsky/video.rs +++ b/crates/weaver-api/src/app_bsky/video.rs @@ -39,7 +39,7 @@ pub struct JobStatus<'a> { pub progress: std::option::Option, /// The state of the video processing job. All values not listed as a known value indicate that the job is in process. #[serde(borrow)] - pub state: jacquard_common::CowStr<'a>, + pub state: JobStatusState<'a>, } pub mod job_status_state { @@ -52,49 +52,49 @@ pub mod job_status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type State; + type Did; type JobId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type State = Unset; + type Did = Unset; type JobId = Unset; } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - type State = S::State; - type JobId = S::JobId; - } ///State transition - sets the `state` field to Set pub struct SetState(PhantomData S>); impl sealed::Sealed for SetState {} impl State for SetState { - type Did = S::Did; type State = Set; + type Did = S::Did; + type JobId = S::JobId; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type State = S::State; + type Did = Set; type JobId = S::JobId; } ///State transition - sets the `job_id` field to Set pub struct SetJobId(PhantomData S>); impl sealed::Sealed for SetJobId {} impl State for SetJobId { - type Did = S::Did; type State = S::State; + type Did = S::Did; type JobId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `state` field pub struct state(()); + ///Marker type for the `did` field + pub struct did(()); ///Marker type for the `job_id` field pub struct job_id(()); } @@ -110,7 +110,7 @@ pub struct JobStatusBuilder<'a, S: job_status_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -243,7 +243,7 @@ where /// Set the `state` field (required) pub fn state( mut self, - value: impl Into>, + value: impl Into>, ) -> JobStatusBuilder<'a, job_status_state::SetState> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); JobStatusBuilder { @@ -257,8 +257,8 @@ where impl<'a, S> JobStatusBuilder<'a, S> where S: job_status_state::State, - S::Did: job_status_state::IsSet, S::State: job_status_state::IsSet, + S::Did: job_status_state::IsSet, S::JobId: job_status_state::IsSet, { /// Build the final struct @@ -295,6 +295,95 @@ where } } +/// The state of the video processing job. All values not listed as a known value indicate that the job is in process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum JobStatusState<'a> { + JobStateCompleted, + JobStateFailed, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> JobStatusState<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::JobStateCompleted => "JOB_STATE_COMPLETED", + Self::JobStateFailed => "JOB_STATE_FAILED", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for JobStatusState<'a> { + fn from(s: &'a str) -> Self { + match s { + "JOB_STATE_COMPLETED" => Self::JobStateCompleted, + "JOB_STATE_FAILED" => Self::JobStateFailed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for JobStatusState<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "JOB_STATE_COMPLETED" => Self::JobStateCompleted, + "JOB_STATE_FAILED" => Self::JobStateFailed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for JobStatusState<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for JobStatusState<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for JobStatusState<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for JobStatusState<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for JobStatusState<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for JobStatusState<'_> { + type Output = JobStatusState<'static>; + fn into_static(self) -> Self::Output { + match self { + JobStatusState::JobStateCompleted => JobStatusState::JobStateCompleted, + JobStatusState::JobStateFailed => JobStatusState::JobStateFailed, + JobStatusState::Other(v) => JobStatusState::Other(v.into_static()), + } + } +} + fn lexicon_doc_app_bsky_video_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -304,7 +393,7 @@ fn lexicon_doc_app_bsky_video_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("jobStatus"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -319,7 +408,7 @@ fn lexicon_doc_app_bsky_video_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blob"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -441,7 +530,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for JobStatus<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.progress { if *value > 100i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { diff --git a/crates/weaver-api/src/blog_pckt/block/blockquote.rs b/crates/weaver-api/src/blog_pckt/block/blockquote.rs index 64d232c..80c7a6b 100644 --- a/crates/weaver-api/src/blog_pckt/block/blockquote.rs +++ b/crates/weaver-api/src/blog_pckt/block/blockquote.rs @@ -136,7 +136,7 @@ fn lexicon_doc_blog_pckt_block_blockquote() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -147,7 +147,7 @@ fn lexicon_doc_blog_pckt_block_blockquote() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -188,7 +188,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Blockquote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/bluesky_embed.rs b/crates/weaver-api/src/blog_pckt/block/bluesky_embed.rs index ab88d21..5c63e17 100644 --- a/crates/weaver-api/src/blog_pckt/block/bluesky_embed.rs +++ b/crates/weaver-api/src/blog_pckt/block/bluesky_embed.rs @@ -136,7 +136,7 @@ fn lexicon_doc_blog_pckt_block_blueskyEmbed() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -147,7 +147,7 @@ fn lexicon_doc_blog_pckt_block_blueskyEmbed() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("postRef"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -178,7 +178,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlueskyEmbed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/bullet_list.rs b/crates/weaver-api/src/blog_pckt/block/bullet_list.rs index 51ed11e..223955a 100644 --- a/crates/weaver-api/src/blog_pckt/block/bullet_list.rs +++ b/crates/weaver-api/src/blog_pckt/block/bullet_list.rs @@ -136,7 +136,7 @@ fn lexicon_doc_blog_pckt_block_bulletList() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -147,7 +147,7 @@ fn lexicon_doc_blog_pckt_block_bulletList() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -185,7 +185,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BulletList<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/code_block.rs b/crates/weaver-api/src/blog_pckt/block/code_block.rs index a98f332..83bdf38 100644 --- a/crates/weaver-api/src/blog_pckt/block/code_block.rs +++ b/crates/weaver-api/src/blog_pckt/block/code_block.rs @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_block_codeBlock() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -49,7 +49,7 @@ fn lexicon_doc_blog_pckt_block_codeBlock() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("language"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -109,7 +109,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CodeBlock<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.language { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 50usize { diff --git a/crates/weaver-api/src/blog_pckt/block/hard_break.rs b/crates/weaver-api/src/blog_pckt/block/hard_break.rs index 2060bba..72624bc 100644 --- a/crates/weaver-api/src/blog_pckt/block/hard_break.rs +++ b/crates/weaver-api/src/blog_pckt/block/hard_break.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_block_hardBreak() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_block_hardBreak() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HardBreak<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/heading.rs b/crates/weaver-api/src/blog_pckt/block/heading.rs index 412ba28..c4f6984 100644 --- a/crates/weaver-api/src/blog_pckt/block/heading.rs +++ b/crates/weaver-api/src/blog_pckt/block/heading.rs @@ -39,7 +39,7 @@ fn lexicon_doc_blog_pckt_block_heading() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -52,7 +52,7 @@ fn lexicon_doc_blog_pckt_block_heading() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("facets"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -124,7 +124,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Heading<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.level { if *value > 6i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { diff --git a/crates/weaver-api/src/blog_pckt/block/horizontal_rule.rs b/crates/weaver-api/src/blog_pckt/block/horizontal_rule.rs index 0711a83..dc82e3e 100644 --- a/crates/weaver-api/src/blog_pckt/block/horizontal_rule.rs +++ b/crates/weaver-api/src/blog_pckt/block/horizontal_rule.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_block_horizontalRule() -> ::jacquard_lexicon::lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_block_horizontalRule() -> ::jacquard_lexicon::lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HorizontalRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/iframe.rs b/crates/weaver-api/src/blog_pckt/block/iframe.rs index 595f04f..fad79a5 100644 --- a/crates/weaver-api/src/blog_pckt/block/iframe.rs +++ b/crates/weaver-api/src/blog_pckt/block/iframe.rs @@ -155,7 +155,7 @@ fn lexicon_doc_blog_pckt_block_iframe() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -166,7 +166,7 @@ fn lexicon_doc_blog_pckt_block_iframe() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -220,7 +220,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Iframe<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.height { if *value > 1600i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { diff --git a/crates/weaver-api/src/blog_pckt/block/image.rs b/crates/weaver-api/src/blog_pckt/block/image.rs index 423dd56..315dd54 100644 --- a/crates/weaver-api/src/blog_pckt/block/image.rs +++ b/crates/weaver-api/src/blog_pckt/block/image.rs @@ -34,37 +34,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Height; type Width; + type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Height = Unset; type Width = Unset; - } - ///State transition - sets the `height` field to Set - pub struct SetHeight(PhantomData S>); - impl sealed::Sealed for SetHeight {} - impl State for SetHeight { - type Height = Set; - type Width = S::Width; + type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth(PhantomData S>); impl sealed::Sealed for SetWidth {} impl State for SetWidth { - type Height = S::Height; type Width = Set; + type Height = S::Height; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight(PhantomData S>); + impl sealed::Sealed for SetHeight {} + impl State for SetHeight { + type Width = S::Width; + type Height = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `height` field - pub struct height(()); ///Marker type for the `width` field pub struct width(()); + ///Marker type for the `height` field + pub struct height(()); } } @@ -134,8 +134,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Height: aspect_ratio_state::IsSet, S::Width: aspect_ratio_state::IsSet, + S::Height: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { @@ -170,7 +170,7 @@ fn lexicon_doc_blog_pckt_block_image() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -188,7 +188,7 @@ fn lexicon_doc_blog_pckt_block_image() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -227,7 +227,7 @@ fn lexicon_doc_blog_pckt_block_image() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("align"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -335,7 +335,7 @@ fn lexicon_doc_blog_pckt_block_image() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("attrs"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -364,7 +364,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AspectRatio<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.height; if *value < 1i64 { @@ -446,7 +446,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ImageAttrs<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.alt { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 1000usize { @@ -658,7 +658,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/list_item.rs b/crates/weaver-api/src/blog_pckt/block/list_item.rs index 8167ce6..d18439b 100644 --- a/crates/weaver-api/src/blog_pckt/block/list_item.rs +++ b/crates/weaver-api/src/blog_pckt/block/list_item.rs @@ -155,7 +155,7 @@ fn lexicon_doc_blog_pckt_block_listItem() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -166,7 +166,7 @@ fn lexicon_doc_blog_pckt_block_listItem() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -209,7 +209,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/mention.rs b/crates/weaver-api/src/blog_pckt/block/mention.rs index 631e7ae..bb7c274 100644 --- a/crates/weaver-api/src/blog_pckt/block/mention.rs +++ b/crates/weaver-api/src/blog_pckt/block/mention.rs @@ -174,7 +174,7 @@ fn lexicon_doc_blog_pckt_block_mention() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -188,7 +188,7 @@ fn lexicon_doc_blog_pckt_block_mention() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -252,7 +252,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Mention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.handle; #[allow(unused_comparisons)] diff --git a/crates/weaver-api/src/blog_pckt/block/ordered_list.rs b/crates/weaver-api/src/blog_pckt/block/ordered_list.rs index 35d2e5d..cacb15d 100644 --- a/crates/weaver-api/src/blog_pckt/block/ordered_list.rs +++ b/crates/weaver-api/src/blog_pckt/block/ordered_list.rs @@ -155,7 +155,7 @@ fn lexicon_doc_blog_pckt_block_orderedList() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -166,7 +166,7 @@ fn lexicon_doc_blog_pckt_block_orderedList() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -215,7 +215,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for OrderedList<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.start { if *value < 1i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { diff --git a/crates/weaver-api/src/blog_pckt/block/paragraph.rs b/crates/weaver-api/src/blog_pckt/block/paragraph.rs index 17b4a1e..ce3f7d7 100644 --- a/crates/weaver-api/src/blog_pckt/block/paragraph.rs +++ b/crates/weaver-api/src/blog_pckt/block/paragraph.rs @@ -58,7 +58,7 @@ fn lexicon_doc_blog_pckt_block_paragraph() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -67,7 +67,7 @@ fn lexicon_doc_blog_pckt_block_paragraph() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -128,7 +128,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Paragraph<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/task_item.rs b/crates/weaver-api/src/blog_pckt/block/task_item.rs index be30f2c..aee720a 100644 --- a/crates/weaver-api/src/blog_pckt/block/task_item.rs +++ b/crates/weaver-api/src/blog_pckt/block/task_item.rs @@ -173,7 +173,7 @@ fn lexicon_doc_blog_pckt_block_taskItem() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -187,7 +187,7 @@ fn lexicon_doc_blog_pckt_block_taskItem() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("checked"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -236,7 +236,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TaskItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/task_list.rs b/crates/weaver-api/src/blog_pckt/block/task_list.rs index 6629177..db9f490 100644 --- a/crates/weaver-api/src/blog_pckt/block/task_list.rs +++ b/crates/weaver-api/src/blog_pckt/block/task_list.rs @@ -136,7 +136,7 @@ fn lexicon_doc_blog_pckt_block_taskList() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -147,7 +147,7 @@ fn lexicon_doc_blog_pckt_block_taskList() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -185,7 +185,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TaskList<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/text.rs b/crates/weaver-api/src/blog_pckt/block/text.rs index 85d3e6c..8a57812 100644 --- a/crates/weaver-api/src/blog_pckt/block/text.rs +++ b/crates/weaver-api/src/blog_pckt/block/text.rs @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_block_text() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -49,7 +49,7 @@ fn lexicon_doc_blog_pckt_block_text() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("facets"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -110,7 +110,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Text<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/block/website.rs b/crates/weaver-api/src/blog_pckt/block/website.rs index 25c7a9d..3e374c7 100644 --- a/crates/weaver-api/src/blog_pckt/block/website.rs +++ b/crates/weaver-api/src/blog_pckt/block/website.rs @@ -211,7 +211,7 @@ fn lexicon_doc_blog_pckt_block_website() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -222,7 +222,7 @@ fn lexicon_doc_blog_pckt_block_website() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -328,7 +328,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Website<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/blog.rs b/crates/weaver-api/src/blog_pckt/blog.rs index 12336a1..648c2fc 100644 --- a/crates/weaver-api/src/blog_pckt/blog.rs +++ b/crates/weaver-api/src/blog_pckt/blog.rs @@ -348,7 +348,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Blog<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -360,7 +360,7 @@ fn lexicon_doc_blog_pckt_blog() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -376,7 +376,7 @@ fn lexicon_doc_blog_pckt_blog() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -490,7 +490,7 @@ fn lexicon_doc_blog_pckt_blog() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -582,7 +582,7 @@ fn lexicon_doc_blog_pckt_blog() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("dark"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -663,7 +663,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Palette<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -704,7 +704,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/document.rs b/crates/weaver-api/src/blog_pckt/document.rs index 28da23b..f75d74d 100644 --- a/crates/weaver-api/src/blog_pckt/document.rs +++ b/crates/weaver-api/src/blog_pckt/document.rs @@ -7,7 +7,13 @@ #[jacquard_derive::lexicon] #[derive( - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Document<'a> { @@ -17,7 +23,7 @@ pub struct Document<'a> { pub mod document_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -50,7 +56,9 @@ pub mod document_state { /// Builder for constructing an instance of this type pub struct DocumentBuilder<'a, S: document_state::State> { _phantom_state: ::core::marker::PhantomData S>, - __unsafe_private_named: (::core::option::Option>,), + __unsafe_private_named: ( + ::core::option::Option>, + ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -133,7 +141,13 @@ impl<'a> Document<'a> { /// Typed wrapper for GetRecord response with this collection's record type. #[derive( - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct DocumentGetRecordOutput<'a> { @@ -185,7 +199,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Document<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -197,44 +211,40 @@ fn lexicon_doc_blog_pckt_document() -> ::jacquard_lexicon::lexicon::LexiconDoc<' revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), - ::jacquard_lexicon::lexicon::LexUserType::Record( - ::jacquard_lexicon::lexicon::LexRecord { + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, - key: Some(::jacquard_common::CowStr::new_static("tid")), - record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object( - ::jacquard_lexicon::lexicon::LexObject { - description: None, - required: Some(vec![ - ::jacquard_common::smol_str::SmolStr::new_static("document"), - ]), - nullable: None, - properties: { - #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); - map.insert( - ::jacquard_common::smol_str::SmolStr::new_static( - "document", - ), - ::jacquard_lexicon::lexicon::LexObjectProperty::Ref( - ::jacquard_lexicon::lexicon::LexRef { - description: None, - r#ref: ::jacquard_common::CowStr::new_static( - "site.standard.document", - ), - }, - ), - ); - map - }, - }, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("document") + ], ), - }, - ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "document", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "site.standard.document", + ), + }), + ); + map + }, + }), + }), ); map }, } -} +} \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/bold.rs b/crates/weaver-api/src/blog_pckt/mark/bold.rs index c05ab88..1f85f1c 100644 --- a/crates/weaver-api/src/blog_pckt/mark/bold.rs +++ b/crates/weaver-api/src/blog_pckt/mark/bold.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_mark_bold() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_mark_bold() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/code.rs b/crates/weaver-api/src/blog_pckt/mark/code.rs index 43a269f..5e3cf1f 100644 --- a/crates/weaver-api/src/blog_pckt/mark/code.rs +++ b/crates/weaver-api/src/blog_pckt/mark/code.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_mark_code() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_mark_code() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/italic.rs b/crates/weaver-api/src/blog_pckt/mark/italic.rs index 90274bb..6e81963 100644 --- a/crates/weaver-api/src/blog_pckt/mark/italic.rs +++ b/crates/weaver-api/src/blog_pckt/mark/italic.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_mark_italic() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_mark_italic() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/link.rs b/crates/weaver-api/src/blog_pckt/mark/link.rs index 816d20b..75079d2 100644 --- a/crates/weaver-api/src/blog_pckt/mark/link.rs +++ b/crates/weaver-api/src/blog_pckt/mark/link.rs @@ -203,7 +203,7 @@ fn lexicon_doc_blog_pckt_mark_link() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("linkAttrs"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -216,7 +216,7 @@ fn lexicon_doc_blog_pckt_mark_link() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("href"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -309,7 +309,7 @@ fn lexicon_doc_blog_pckt_mark_link() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("attrs"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -338,7 +338,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinkAttrs<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.href; #[allow(unused_comparisons)] @@ -526,7 +526,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/strike.rs b/crates/weaver-api/src/blog_pckt/mark/strike.rs index 9086e37..d7dfb72 100644 --- a/crates/weaver-api/src/blog_pckt/mark/strike.rs +++ b/crates/weaver-api/src/blog_pckt/mark/strike.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_mark_strike() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_mark_strike() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strike<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/mark/underline.rs b/crates/weaver-api/src/blog_pckt/mark/underline.rs index 61df6c7..a65e97f 100644 --- a/crates/weaver-api/src/blog_pckt/mark/underline.rs +++ b/crates/weaver-api/src/blog_pckt/mark/underline.rs @@ -27,7 +27,7 @@ fn lexicon_doc_blog_pckt_mark_underline() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_blog_pckt_mark_underline() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/post.rs b/crates/weaver-api/src/blog_pckt/post.rs index 247dd01..e757496 100644 --- a/crates/weaver-api/src/blog_pckt/post.rs +++ b/crates/weaver-api/src/blog_pckt/post.rs @@ -53,67 +53,67 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Blog; type Title; type Blocks; type Url; + type Blog; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Blog = Unset; type Title = Unset; type Blocks = Unset; type Url = Unset; - } - ///State transition - sets the `blog` field to Set - pub struct SetBlog(PhantomData S>); - impl sealed::Sealed for SetBlog {} - impl State for SetBlog { - type Blog = Set; - type Title = S::Title; - type Blocks = S::Blocks; - type Url = S::Url; + type Blog = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { - type Blog = S::Blog; type Title = Set; type Blocks = S::Blocks; type Url = S::Url; + type Blog = S::Blog; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks(PhantomData S>); impl sealed::Sealed for SetBlocks {} impl State for SetBlocks { - type Blog = S::Blog; type Title = S::Title; type Blocks = Set; type Url = S::Url; + type Blog = S::Blog; } ///State transition - sets the `url` field to Set pub struct SetUrl(PhantomData S>); impl sealed::Sealed for SetUrl {} impl State for SetUrl { - type Blog = S::Blog; type Title = S::Title; type Blocks = S::Blocks; type Url = Set; + type Blog = S::Blog; + } + ///State transition - sets the `blog` field to Set + pub struct SetBlog(PhantomData S>); + impl sealed::Sealed for SetBlog {} + impl State for SetBlog { + type Title = S::Title; + type Blocks = S::Blocks; + type Url = S::Url; + type Blog = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `blog` field - pub struct blog(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `blocks` field pub struct blocks(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `blog` field + pub struct blog(()); } } @@ -357,10 +357,10 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::Blog: post_state::IsSet, S::Title: post_state::IsSet, S::Blocks: post_state::IsSet, S::Url: post_state::IsSet, + S::Blog: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { @@ -475,7 +475,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Post<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -487,7 +487,7 @@ fn lexicon_doc_blog_pckt_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -506,7 +506,7 @@ fn lexicon_doc_blog_pckt_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<'stat nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocks"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { diff --git a/crates/weaver-api/src/blog_pckt/publication.rs b/crates/weaver-api/src/blog_pckt/publication.rs index e488d35..c0bd614 100644 --- a/crates/weaver-api/src/blog_pckt/publication.rs +++ b/crates/weaver-api/src/blog_pckt/publication.rs @@ -199,7 +199,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Publication<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -213,7 +213,7 @@ fn lexicon_doc_blog_pckt_publication() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -229,7 +229,7 @@ fn lexicon_doc_blog_pckt_publication() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "publication", diff --git a/crates/weaver-api/src/blog_pckt/richtext/facet.rs b/crates/weaver-api/src/blog_pckt/richtext/facet.rs index 46b45a0..8e28b64 100644 --- a/crates/weaver-api/src/blog_pckt/richtext/facet.rs +++ b/crates/weaver-api/src/blog_pckt/richtext/facet.rs @@ -136,7 +136,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atMention"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -151,7 +151,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atURI"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -185,7 +185,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -207,7 +207,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -248,7 +248,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -267,7 +267,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -301,7 +301,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -318,7 +318,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -350,7 +350,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -369,7 +369,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -402,7 +402,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("features"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -450,7 +450,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -467,7 +467,7 @@ fn lexicon_doc_blog_pckt_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -489,7 +489,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AtMention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -520,7 +520,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -552,37 +552,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteEnd; type ByteStart; + type ByteEnd; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteEnd = Unset; type ByteStart = Unset; - } - ///State transition - sets the `byte_end` field to Set - pub struct SetByteEnd(PhantomData S>); - impl sealed::Sealed for SetByteEnd {} - impl State for SetByteEnd { - type ByteEnd = Set; - type ByteStart = S::ByteStart; + type ByteEnd = Unset; } ///State transition - sets the `byte_start` field to Set pub struct SetByteStart(PhantomData S>); impl sealed::Sealed for SetByteStart {} impl State for SetByteStart { - type ByteEnd = S::ByteEnd; type ByteStart = Set; + type ByteEnd = S::ByteEnd; + } + ///State transition - sets the `byte_end` field to Set + pub struct SetByteEnd(PhantomData S>); + impl sealed::Sealed for SetByteEnd {} + impl State for SetByteEnd { + type ByteStart = S::ByteStart; + type ByteEnd = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_end` field - pub struct byte_end(()); ///Marker type for the `byte_start` field pub struct byte_start(()); + ///Marker type for the `byte_end` field + pub struct byte_end(()); } } @@ -652,8 +652,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteEnd: byte_slice_state::IsSet, S::ByteStart: byte_slice_state::IsSet, + S::ByteEnd: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -691,7 +691,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.byte_end; if *value < 0i64 { @@ -746,7 +746,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -885,7 +885,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DidMention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -916,7 +916,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Highlight<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -952,7 +952,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -983,7 +983,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1018,7 +1018,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1228,7 +1228,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1259,7 +1259,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strikethrough<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1290,7 +1290,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/blog_pckt/theme.rs b/crates/weaver-api/src/blog_pckt/theme.rs index c75b80b..ba074ec 100644 --- a/crates/weaver-api/src/blog_pckt/theme.rs +++ b/crates/weaver-api/src/blog_pckt/theme.rs @@ -196,7 +196,7 @@ fn lexicon_doc_blog_pckt_theme() -> ::jacquard_lexicon::lexicon::LexiconDoc<'sta revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -214,7 +214,7 @@ fn lexicon_doc_blog_pckt_theme() -> ::jacquard_lexicon::lexicon::LexiconDoc<'sta nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("dark"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -272,7 +272,7 @@ fn lexicon_doc_blog_pckt_theme() -> ::jacquard_lexicon::lexicon::LexiconDoc<'sta nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -393,7 +393,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.font { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 100usize { @@ -453,7 +453,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Palette<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.accent; #[allow(unused_comparisons)] diff --git a/crates/weaver-api/src/chat_bsky/actor.rs b/crates/weaver-api/src/chat_bsky/actor.rs index ced6c00..2b55ebb 100644 --- a/crates/weaver-api/src/chat_bsky/actor.rs +++ b/crates/weaver-api/src/chat_bsky/actor.rs @@ -355,7 +355,7 @@ fn lexicon_doc_chat_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("profileViewBasic"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -369,7 +369,7 @@ fn lexicon_doc_chat_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "associated", @@ -514,7 +514,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileViewBasic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.display_name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 640usize { diff --git a/crates/weaver-api/src/chat_bsky/actor/declaration.rs b/crates/weaver-api/src/chat_bsky/actor/declaration.rs index 7bcbadc..fb84892 100644 --- a/crates/weaver-api/src/chat_bsky/actor/declaration.rs +++ b/crates/weaver-api/src/chat_bsky/actor/declaration.rs @@ -19,7 +19,7 @@ #[serde(rename_all = "camelCase")] pub struct Declaration<'a> { #[serde(borrow)] - pub allow_incoming: jacquard_common::CowStr<'a>, + pub allow_incoming: DeclarationAllowIncoming<'a>, } pub mod declaration_state { @@ -57,7 +57,7 @@ pub mod declaration_state { /// Builder for constructing an instance of this type pub struct DeclarationBuilder<'a, S: declaration_state::State> { _phantom_state: ::core::marker::PhantomData S>, - __unsafe_private_named: (::core::option::Option>,), + __unsafe_private_named: (::core::option::Option>,), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -87,7 +87,7 @@ where /// Set the `allowIncoming` field (required) pub fn allow_incoming( mut self, - value: impl Into>, + value: impl Into>, ) -> DeclarationBuilder<'a, declaration_state::SetAllowIncoming> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DeclarationBuilder { @@ -138,6 +138,101 @@ impl<'a> Declaration<'a> { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum DeclarationAllowIncoming<'a> { + All, + None, + Following, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> DeclarationAllowIncoming<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::All => "all", + Self::None => "none", + Self::Following => "following", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for DeclarationAllowIncoming<'a> { + fn from(s: &'a str) -> Self { + match s { + "all" => Self::All, + "none" => Self::None, + "following" => Self::Following, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for DeclarationAllowIncoming<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "all" => Self::All, + "none" => Self::None, + "following" => Self::Following, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for DeclarationAllowIncoming<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for DeclarationAllowIncoming<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for DeclarationAllowIncoming<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for DeclarationAllowIncoming<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for DeclarationAllowIncoming<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for DeclarationAllowIncoming<'_> { + type Output = DeclarationAllowIncoming<'static>; + fn into_static(self) -> Self::Output { + match self { + DeclarationAllowIncoming::All => DeclarationAllowIncoming::All, + DeclarationAllowIncoming::None => DeclarationAllowIncoming::None, + DeclarationAllowIncoming::Following => DeclarationAllowIncoming::Following, + DeclarationAllowIncoming::Other(v) => { + DeclarationAllowIncoming::Other(v.into_static()) + } + } + } +} + /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, @@ -198,7 +293,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Declaration<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -212,7 +307,7 @@ fn lexicon_doc_chat_bsky_actor_declaration() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -232,7 +327,7 @@ fn lexicon_doc_chat_bsky_actor_declaration() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "allowIncoming", diff --git a/crates/weaver-api/src/chat_bsky/convo.rs b/crates/weaver-api/src/chat_bsky/convo.rs index 8a10a16..c043881 100644 --- a/crates/weaver-api/src/chat_bsky/convo.rs +++ b/crates/weaver-api/src/chat_bsky/convo.rs @@ -52,7 +52,7 @@ pub struct ConvoView<'a> { pub rev: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, pub unread_count: i64, } @@ -66,85 +66,85 @@ pub mod convo_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Muted; + type UnreadCount; type Id; type Members; - type Muted; type Rev; - type UnreadCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Muted = Unset; + type UnreadCount = Unset; type Id = Unset; type Members = Unset; - type Muted = Unset; type Rev = Unset; - type UnreadCount = Unset; + } + ///State transition - sets the `muted` field to Set + pub struct SetMuted(PhantomData S>); + impl sealed::Sealed for SetMuted {} + impl State for SetMuted { + type Muted = Set; + type UnreadCount = S::UnreadCount; + type Id = S::Id; + type Members = S::Members; + type Rev = S::Rev; + } + ///State transition - sets the `unread_count` field to Set + pub struct SetUnreadCount(PhantomData S>); + impl sealed::Sealed for SetUnreadCount {} + impl State for SetUnreadCount { + type Muted = S::Muted; + type UnreadCount = Set; + type Id = S::Id; + type Members = S::Members; + type Rev = S::Rev; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { + type Muted = S::Muted; + type UnreadCount = S::UnreadCount; type Id = Set; type Members = S::Members; - type Muted = S::Muted; type Rev = S::Rev; - type UnreadCount = S::UnreadCount; } ///State transition - sets the `members` field to Set pub struct SetMembers(PhantomData S>); impl sealed::Sealed for SetMembers {} impl State for SetMembers { - type Id = S::Id; - type Members = Set; type Muted = S::Muted; - type Rev = S::Rev; type UnreadCount = S::UnreadCount; - } - ///State transition - sets the `muted` field to Set - pub struct SetMuted(PhantomData S>); - impl sealed::Sealed for SetMuted {} - impl State for SetMuted { type Id = S::Id; - type Members = S::Members; - type Muted = Set; + type Members = Set; type Rev = S::Rev; - type UnreadCount = S::UnreadCount; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData S>); impl sealed::Sealed for SetRev {} impl State for SetRev { - type Id = S::Id; - type Members = S::Members; type Muted = S::Muted; - type Rev = Set; type UnreadCount = S::UnreadCount; - } - ///State transition - sets the `unread_count` field to Set - pub struct SetUnreadCount(PhantomData S>); - impl sealed::Sealed for SetUnreadCount {} - impl State for SetUnreadCount { type Id = S::Id; type Members = S::Members; - type Muted = S::Muted; - type Rev = S::Rev; - type UnreadCount = Set; + type Rev = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `muted` field + pub struct muted(()); + ///Marker type for the `unread_count` field + pub struct unread_count(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `members` field pub struct members(()); - ///Marker type for the `muted` field - pub struct muted(()); ///Marker type for the `rev` field pub struct rev(()); - ///Marker type for the `unread_count` field - pub struct unread_count(()); } } @@ -158,7 +158,7 @@ pub struct ConvoViewBuilder<'a, S: convo_view_state::State> { ::core::option::Option>>, ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -298,15 +298,12 @@ where impl<'a, S: convo_view_state::State> ConvoViewBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.6 = value; self } @@ -334,11 +331,11 @@ where impl<'a, S> ConvoViewBuilder<'a, S> where S: convo_view_state::State, + S::Muted: convo_view_state::IsSet, + S::UnreadCount: convo_view_state::IsSet, S::Id: convo_view_state::IsSet, S::Members: convo_view_state::IsSet, - S::Muted: convo_view_state::IsSet, S::Rev: convo_view_state::IsSet, - S::UnreadCount: convo_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ConvoView<'a> { @@ -395,6 +392,94 @@ pub enum ConvoViewLastMessage<'a> { DeletedMessageView(Box>), } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ConvoViewStatus<'a> { + Request, + Accepted, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ConvoViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Request => "request", + Self::Accepted => "accepted", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ConvoViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "request" => Self::Request, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ConvoViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "request" => Self::Request, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ConvoViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ConvoViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ConvoViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ConvoViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ConvoViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ConvoViewStatus<'_> { + type Output = ConvoViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + ConvoViewStatus::Request => ConvoViewStatus::Request, + ConvoViewStatus::Accepted => ConvoViewStatus::Accepted, + ConvoViewStatus::Other(v) => ConvoViewStatus::Other(v.into_static()), + } + } +} + fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -404,7 +489,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -421,7 +506,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -546,7 +631,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -620,7 +705,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -670,7 +755,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -738,7 +823,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -787,7 +872,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -847,7 +932,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -906,7 +991,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -954,7 +1039,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1003,7 +1088,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1064,7 +1149,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1132,7 +1217,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1182,7 +1267,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("message"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1213,7 +1298,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("embed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -1275,7 +1360,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1345,7 +1430,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("embed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -1479,7 +1564,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1515,7 +1600,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -1573,7 +1658,7 @@ fn lexicon_doc_chat_bsky_convo_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1612,7 +1697,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ConvoView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1648,8 +1733,8 @@ pub mod deleted_message_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SentAt; type Sender; + type SentAt; type Id; type Rev; } @@ -1657,26 +1742,26 @@ pub mod deleted_message_view_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SentAt = Unset; type Sender = Unset; + type SentAt = Unset; type Id = Unset; type Rev = Unset; } - ///State transition - sets the `sent_at` field to Set - pub struct SetSentAt(PhantomData S>); - impl sealed::Sealed for SetSentAt {} - impl State for SetSentAt { - type SentAt = Set; - type Sender = S::Sender; - type Id = S::Id; - type Rev = S::Rev; - } ///State transition - sets the `sender` field to Set pub struct SetSender(PhantomData S>); impl sealed::Sealed for SetSender {} impl State for SetSender { - type SentAt = S::SentAt; type Sender = Set; + type SentAt = S::SentAt; + type Id = S::Id; + type Rev = S::Rev; + } + ///State transition - sets the `sent_at` field to Set + pub struct SetSentAt(PhantomData S>); + impl sealed::Sealed for SetSentAt {} + impl State for SetSentAt { + type Sender = S::Sender; + type SentAt = Set; type Id = S::Id; type Rev = S::Rev; } @@ -1684,8 +1769,8 @@ pub mod deleted_message_view_state { pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { - type SentAt = S::SentAt; type Sender = S::Sender; + type SentAt = S::SentAt; type Id = Set; type Rev = S::Rev; } @@ -1693,18 +1778,18 @@ pub mod deleted_message_view_state { pub struct SetRev(PhantomData S>); impl sealed::Sealed for SetRev {} impl State for SetRev { - type SentAt = S::SentAt; type Sender = S::Sender; + type SentAt = S::SentAt; type Id = S::Id; type Rev = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `sent_at` field - pub struct sent_at(()); ///Marker type for the `sender` field pub struct sender(()); + ///Marker type for the `sent_at` field + pub struct sent_at(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `rev` field @@ -1821,8 +1906,8 @@ where impl<'a, S> DeletedMessageViewBuilder<'a, S> where S: deleted_message_view_state::State, - S::SentAt: deleted_message_view_state::IsSet, S::Sender: deleted_message_view_state::IsSet, + S::SentAt: deleted_message_view_state::IsSet, S::Id: deleted_message_view_state::IsSet, S::Rev: deleted_message_view_state::IsSet, { @@ -1866,7 +1951,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DeletedMessageView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1902,7 +1987,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogAcceptConvo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1939,67 +2024,67 @@ pub mod log_add_reaction_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ConvoId; + type Rev; type Message; type Reaction; - type Rev; + type ConvoId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ConvoId = Unset; + type Rev = Unset; type Message = Unset; type Reaction = Unset; - type Rev = Unset; + type ConvoId = Unset; } - ///State transition - sets the `convo_id` field to Set - pub struct SetConvoId(PhantomData S>); - impl sealed::Sealed for SetConvoId {} - impl State for SetConvoId { - type ConvoId = Set; + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { + type Rev = Set; type Message = S::Message; type Reaction = S::Reaction; - type Rev = S::Rev; + type ConvoId = S::ConvoId; } ///State transition - sets the `message` field to Set pub struct SetMessage(PhantomData S>); impl sealed::Sealed for SetMessage {} impl State for SetMessage { - type ConvoId = S::ConvoId; + type Rev = S::Rev; type Message = Set; type Reaction = S::Reaction; - type Rev = S::Rev; + type ConvoId = S::ConvoId; } ///State transition - sets the `reaction` field to Set pub struct SetReaction(PhantomData S>); impl sealed::Sealed for SetReaction {} impl State for SetReaction { - type ConvoId = S::ConvoId; + type Rev = S::Rev; type Message = S::Message; type Reaction = Set; - type Rev = S::Rev; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { type ConvoId = S::ConvoId; + } + ///State transition - sets the `convo_id` field to Set + pub struct SetConvoId(PhantomData S>); + impl sealed::Sealed for SetConvoId {} + impl State for SetConvoId { + type Rev = S::Rev; type Message = S::Message; type Reaction = S::Reaction; - type Rev = Set; + type ConvoId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `convo_id` field - pub struct convo_id(()); + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `message` field pub struct message(()); ///Marker type for the `reaction` field pub struct reaction(()); - ///Marker type for the `rev` field - pub struct rev(()); + ///Marker type for the `convo_id` field + pub struct convo_id(()); } } @@ -2112,10 +2197,10 @@ where impl<'a, S> LogAddReactionBuilder<'a, S> where S: log_add_reaction_state::State, - S::ConvoId: log_add_reaction_state::IsSet, + S::Rev: log_add_reaction_state::IsSet, S::Message: log_add_reaction_state::IsSet, S::Reaction: log_add_reaction_state::IsSet, - S::Rev: log_add_reaction_state::IsSet, + S::ConvoId: log_add_reaction_state::IsSet, { /// Build the final struct pub fn build(self) -> LogAddReaction<'a> { @@ -2176,7 +2261,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogAddReaction<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2212,7 +2297,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogBeginConvo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2445,7 +2530,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogCreateMessage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2480,51 +2565,51 @@ pub mod log_delete_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ConvoId; - type Rev; type Message; + type Rev; + type ConvoId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ConvoId = Unset; - type Rev = Unset; type Message = Unset; + type Rev = Unset; + type ConvoId = Unset; } - ///State transition - sets the `convo_id` field to Set - pub struct SetConvoId(PhantomData S>); - impl sealed::Sealed for SetConvoId {} - impl State for SetConvoId { - type ConvoId = Set; + ///State transition - sets the `message` field to Set + pub struct SetMessage(PhantomData S>); + impl sealed::Sealed for SetMessage {} + impl State for SetMessage { + type Message = Set; type Rev = S::Rev; - type Message = S::Message; + type ConvoId = S::ConvoId; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData S>); impl sealed::Sealed for SetRev {} impl State for SetRev { - type ConvoId = S::ConvoId; - type Rev = Set; type Message = S::Message; - } - ///State transition - sets the `message` field to Set - pub struct SetMessage(PhantomData S>); - impl sealed::Sealed for SetMessage {} - impl State for SetMessage { + type Rev = Set; type ConvoId = S::ConvoId; + } + ///State transition - sets the `convo_id` field to Set + pub struct SetConvoId(PhantomData S>); + impl sealed::Sealed for SetConvoId {} + impl State for SetConvoId { + type Message = S::Message; type Rev = S::Rev; - type Message = Set; + type ConvoId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `convo_id` field - pub struct convo_id(()); - ///Marker type for the `rev` field - pub struct rev(()); ///Marker type for the `message` field pub struct message(()); + ///Marker type for the `rev` field + pub struct rev(()); + ///Marker type for the `convo_id` field + pub struct convo_id(()); } } @@ -2617,9 +2702,9 @@ where impl<'a, S> LogDeleteMessageBuilder<'a, S> where S: log_delete_message_state::State, - S::ConvoId: log_delete_message_state::IsSet, - S::Rev: log_delete_message_state::IsSet, S::Message: log_delete_message_state::IsSet, + S::Rev: log_delete_message_state::IsSet, + S::ConvoId: log_delete_message_state::IsSet, { /// Build the final struct pub fn build(self) -> LogDeleteMessage<'a> { @@ -2678,7 +2763,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogDeleteMessage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2714,7 +2799,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogLeaveConvo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2750,7 +2835,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogMuteConvo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2785,51 +2870,51 @@ pub mod log_read_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Rev; type Message; type ConvoId; - type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Rev = Unset; type Message = Unset; type ConvoId = Unset; - type Rev = Unset; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { + type Rev = Set; + type Message = S::Message; + type ConvoId = S::ConvoId; } ///State transition - sets the `message` field to Set pub struct SetMessage(PhantomData S>); impl sealed::Sealed for SetMessage {} impl State for SetMessage { + type Rev = S::Rev; type Message = Set; type ConvoId = S::ConvoId; - type Rev = S::Rev; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId(PhantomData S>); impl sealed::Sealed for SetConvoId {} impl State for SetConvoId { - type Message = S::Message; - type ConvoId = Set; type Rev = S::Rev; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { type Message = S::Message; - type ConvoId = S::ConvoId; - type Rev = Set; + type ConvoId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `message` field pub struct message(()); ///Marker type for the `convo_id` field pub struct convo_id(()); - ///Marker type for the `rev` field - pub struct rev(()); } } @@ -2922,9 +3007,9 @@ where impl<'a, S> LogReadMessageBuilder<'a, S> where S: log_read_message_state::State, + S::Rev: log_read_message_state::IsSet, S::Message: log_read_message_state::IsSet, S::ConvoId: log_read_message_state::IsSet, - S::Rev: log_read_message_state::IsSet, { /// Build the final struct pub fn build(self) -> LogReadMessage<'a> { @@ -2983,7 +3068,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogReadMessage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3020,67 +3105,67 @@ pub mod log_remove_reaction_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; - type ConvoId; type Reaction; + type ConvoId; type Message; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; - type ConvoId = Unset; type Reaction = Unset; + type ConvoId = Unset; type Message = Unset; + type Rev = Unset; } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { - type Rev = Set; + ///State transition - sets the `reaction` field to Set + pub struct SetReaction(PhantomData S>); + impl sealed::Sealed for SetReaction {} + impl State for SetReaction { + type Reaction = Set; type ConvoId = S::ConvoId; - type Reaction = S::Reaction; type Message = S::Message; + type Rev = S::Rev; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId(PhantomData S>); impl sealed::Sealed for SetConvoId {} impl State for SetConvoId { - type Rev = S::Rev; - type ConvoId = Set; type Reaction = S::Reaction; + type ConvoId = Set; type Message = S::Message; - } - ///State transition - sets the `reaction` field to Set - pub struct SetReaction(PhantomData S>); - impl sealed::Sealed for SetReaction {} - impl State for SetReaction { type Rev = S::Rev; - type ConvoId = S::ConvoId; - type Reaction = Set; - type Message = S::Message; } ///State transition - sets the `message` field to Set pub struct SetMessage(PhantomData S>); impl sealed::Sealed for SetMessage {} impl State for SetMessage { - type Rev = S::Rev; - type ConvoId = S::ConvoId; type Reaction = S::Reaction; + type ConvoId = S::ConvoId; type Message = Set; + type Rev = S::Rev; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { + type Reaction = S::Reaction; + type ConvoId = S::ConvoId; + type Message = S::Message; + type Rev = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); - ///Marker type for the `convo_id` field - pub struct convo_id(()); ///Marker type for the `reaction` field pub struct reaction(()); + ///Marker type for the `convo_id` field + pub struct convo_id(()); ///Marker type for the `message` field pub struct message(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -3193,10 +3278,10 @@ where impl<'a, S> LogRemoveReactionBuilder<'a, S> where S: log_remove_reaction_state::State, - S::Rev: log_remove_reaction_state::IsSet, - S::ConvoId: log_remove_reaction_state::IsSet, S::Reaction: log_remove_reaction_state::IsSet, + S::ConvoId: log_remove_reaction_state::IsSet, S::Message: log_remove_reaction_state::IsSet, + S::Rev: log_remove_reaction_state::IsSet, { /// Build the final struct pub fn build(self) -> LogRemoveReaction<'a> { @@ -3257,7 +3342,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogRemoveReaction<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3293,7 +3378,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LogUnmuteConvo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3477,7 +3562,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageAndReactionView<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3518,7 +3603,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageInput<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.text; #[allow(unused_comparisons)] @@ -3585,51 +3670,51 @@ pub mod message_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type MessageId; type ConvoId; type Did; - type MessageId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type MessageId = Unset; type ConvoId = Unset; type Did = Unset; - type MessageId = Unset; + } + ///State transition - sets the `message_id` field to Set + pub struct SetMessageId(PhantomData S>); + impl sealed::Sealed for SetMessageId {} + impl State for SetMessageId { + type MessageId = Set; + type ConvoId = S::ConvoId; + type Did = S::Did; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId(PhantomData S>); impl sealed::Sealed for SetConvoId {} impl State for SetConvoId { + type MessageId = S::MessageId; type ConvoId = Set; type Did = S::Did; - type MessageId = S::MessageId; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type ConvoId = S::ConvoId; - type Did = Set; type MessageId = S::MessageId; - } - ///State transition - sets the `message_id` field to Set - pub struct SetMessageId(PhantomData S>); - impl sealed::Sealed for SetMessageId {} - impl State for SetMessageId { type ConvoId = S::ConvoId; - type Did = S::Did; - type MessageId = Set; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `message_id` field + pub struct message_id(()); ///Marker type for the `convo_id` field pub struct convo_id(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `message_id` field - pub struct message_id(()); } } @@ -3722,9 +3807,9 @@ where impl<'a, S> MessageRefBuilder<'a, S> where S: message_ref_state::State, + S::MessageId: message_ref_state::IsSet, S::ConvoId: message_ref_state::IsSet, S::Did: message_ref_state::IsSet, - S::MessageId: message_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> MessageRef<'a> { @@ -3764,7 +3849,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3813,83 +3898,83 @@ pub mod message_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; + type Id; type Sender; + type Rev; type Text; - type Id; type SentAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; + type Id = Unset; type Sender = Unset; + type Rev = Unset; type Text = Unset; - type Id = Unset; type SentAt = Unset; } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { - type Rev = Set; + ///State transition - sets the `id` field to Set + pub struct SetId(PhantomData S>); + impl sealed::Sealed for SetId {} + impl State for SetId { + type Id = Set; type Sender = S::Sender; + type Rev = S::Rev; type Text = S::Text; - type Id = S::Id; type SentAt = S::SentAt; } ///State transition - sets the `sender` field to Set pub struct SetSender(PhantomData S>); impl sealed::Sealed for SetSender {} impl State for SetSender { - type Rev = S::Rev; + type Id = S::Id; type Sender = Set; + type Rev = S::Rev; type Text = S::Text; + type SentAt = S::SentAt; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { type Id = S::Id; + type Sender = S::Sender; + type Rev = Set; + type Text = S::Text; type SentAt = S::SentAt; } ///State transition - sets the `text` field to Set pub struct SetText(PhantomData S>); impl sealed::Sealed for SetText {} impl State for SetText { - type Rev = S::Rev; - type Sender = S::Sender; - type Text = Set; type Id = S::Id; - type SentAt = S::SentAt; - } - ///State transition - sets the `id` field to Set - pub struct SetId(PhantomData S>); - impl sealed::Sealed for SetId {} - impl State for SetId { - type Rev = S::Rev; type Sender = S::Sender; - type Text = S::Text; - type Id = Set; + type Rev = S::Rev; + type Text = Set; type SentAt = S::SentAt; } ///State transition - sets the `sent_at` field to Set pub struct SetSentAt(PhantomData S>); impl sealed::Sealed for SetSentAt {} impl State for SetSentAt { - type Rev = S::Rev; + type Id = S::Id; type Sender = S::Sender; + type Rev = S::Rev; type Text = S::Text; - type Id = S::Id; type SentAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `sender` field pub struct sender(()); + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `text` field pub struct text(()); - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `sent_at` field pub struct sent_at(()); } @@ -4084,10 +4169,10 @@ where impl<'a, S> MessageViewBuilder<'a, S> where S: message_view_state::State, - S::Rev: message_view_state::IsSet, + S::Id: message_view_state::IsSet, S::Sender: message_view_state::IsSet, + S::Rev: message_view_state::IsSet, S::Text: message_view_state::IsSet, - S::Id: message_view_state::IsSet, S::SentAt: message_view_state::IsSet, { /// Build the final struct @@ -4138,7 +4223,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.text; #[allow(unused_comparisons)] @@ -4308,7 +4393,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageViewSender<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4342,51 +4427,51 @@ pub mod reaction_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Sender; type Value; + type Sender; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Sender = Unset; type Value = Unset; + type Sender = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Value = Set; type Sender = S::Sender; - type Value = S::Value; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `sender` field to Set pub struct SetSender(PhantomData S>); impl sealed::Sealed for SetSender {} impl State for SetSender { - type CreatedAt = S::CreatedAt; - type Sender = Set; type Value = S::Value; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { + type Sender = Set; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Value = S::Value; type Sender = S::Sender; - type Value = Set; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `sender` field - pub struct sender(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `sender` field + pub struct sender(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -4479,9 +4564,9 @@ where impl<'a, S> ReactionViewBuilder<'a, S> where S: reaction_view_state::State, - S::CreatedAt: reaction_view_state::IsSet, - S::Sender: reaction_view_state::IsSet, S::Value: reaction_view_state::IsSet, + S::Sender: reaction_view_state::IsSet, + S::CreatedAt: reaction_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ReactionView<'a> { @@ -4521,7 +4606,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReactionView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4659,7 +4744,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReactionViewSender<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/chat_bsky/convo/add_reaction.rs b/crates/weaver-api/src/chat_bsky/convo/add_reaction.rs index ade7678..ba6f916 100644 --- a/crates/weaver-api/src/chat_bsky/convo/add_reaction.rs +++ b/crates/weaver-api/src/chat_bsky/convo/add_reaction.rs @@ -68,8 +68,8 @@ pub enum AddReactionError<'a> { ReactionInvalidValue(std::option::Option>), } -impl std::fmt::Display for AddReactionError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for AddReactionError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ReactionMessageDeleted(msg) => { write!(f, "ReactionMessageDeleted")?; diff --git a/crates/weaver-api/src/chat_bsky/convo/remove_reaction.rs b/crates/weaver-api/src/chat_bsky/convo/remove_reaction.rs index ae6eb34..9b014e8 100644 --- a/crates/weaver-api/src/chat_bsky/convo/remove_reaction.rs +++ b/crates/weaver-api/src/chat_bsky/convo/remove_reaction.rs @@ -65,8 +65,8 @@ pub enum RemoveReactionError<'a> { ReactionInvalidValue(std::option::Option>), } -impl std::fmt::Display for RemoveReactionError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for RemoveReactionError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ReactionMessageDeleted(msg) => { write!(f, "ReactionMessageDeleted")?; diff --git a/crates/weaver-api/src/chat_bsky/convo/send_message.rs b/crates/weaver-api/src/chat_bsky/convo/send_message.rs index 5950b13..a6b37be 100644 --- a/crates/weaver-api/src/chat_bsky/convo/send_message.rs +++ b/crates/weaver-api/src/chat_bsky/convo/send_message.rs @@ -33,37 +33,37 @@ pub mod send_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ConvoId; type Message; + type ConvoId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ConvoId = Unset; type Message = Unset; - } - ///State transition - sets the `convo_id` field to Set - pub struct SetConvoId(PhantomData S>); - impl sealed::Sealed for SetConvoId {} - impl State for SetConvoId { - type ConvoId = Set; - type Message = S::Message; + type ConvoId = Unset; } ///State transition - sets the `message` field to Set pub struct SetMessage(PhantomData S>); impl sealed::Sealed for SetMessage {} impl State for SetMessage { - type ConvoId = S::ConvoId; type Message = Set; + type ConvoId = S::ConvoId; + } + ///State transition - sets the `convo_id` field to Set + pub struct SetConvoId(PhantomData S>); + impl sealed::Sealed for SetConvoId {} + impl State for SetConvoId { + type Message = S::Message; + type ConvoId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `convo_id` field - pub struct convo_id(()); ///Marker type for the `message` field pub struct message(()); + ///Marker type for the `convo_id` field + pub struct convo_id(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> SendMessageBuilder<'a, S> where S: send_message_state::State, - S::ConvoId: send_message_state::IsSet, S::Message: send_message_state::IsSet, + S::ConvoId: send_message_state::IsSet, { /// Build the final struct pub fn build(self) -> SendMessage<'a> { diff --git a/crates/weaver-api/src/chat_bsky/convo/send_message_batch.rs b/crates/weaver-api/src/chat_bsky/convo/send_message_batch.rs index 4b541df..c4e6468 100644 --- a/crates/weaver-api/src/chat_bsky/convo/send_message_batch.rs +++ b/crates/weaver-api/src/chat_bsky/convo/send_message_batch.rs @@ -33,37 +33,37 @@ pub mod batch_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Message; type ConvoId; + type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Message = Unset; type ConvoId = Unset; - } - ///State transition - sets the `message` field to Set - pub struct SetMessage(PhantomData S>); - impl sealed::Sealed for SetMessage {} - impl State for SetMessage { - type Message = Set; - type ConvoId = S::ConvoId; + type Message = Unset; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId(PhantomData S>); impl sealed::Sealed for SetConvoId {} impl State for SetConvoId { - type Message = S::Message; type ConvoId = Set; + type Message = S::Message; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage(PhantomData S>); + impl sealed::Sealed for SetMessage {} + impl State for SetMessage { + type ConvoId = S::ConvoId; + type Message = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `message` field - pub struct message(()); ///Marker type for the `convo_id` field pub struct convo_id(()); + ///Marker type for the `message` field + pub struct message(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> BatchItemBuilder<'a, S> where S: batch_item_state::State, - S::Message: batch_item_state::IsSet, S::ConvoId: batch_item_state::IsSet, + S::Message: batch_item_state::IsSet, { /// Build the final struct pub fn build(self) -> BatchItem<'a> { @@ -172,7 +172,7 @@ fn lexicon_doc_chat_bsky_convo_sendMessageBatch() -> ::jacquard_lexicon::lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("batchItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_chat_bsky_convo_sendMessageBatch() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convoId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -236,7 +236,7 @@ fn lexicon_doc_chat_bsky_convo_sendMessageBatch() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("items"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -275,7 +275,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BatchItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/chat_bsky/convo/update_all_read.rs b/crates/weaver-api/src/chat_bsky/convo/update_all_read.rs index 89cde43..5a6da4d 100644 --- a/crates/weaver-api/src/chat_bsky/convo/update_all_read.rs +++ b/crates/weaver-api/src/chat_bsky/convo/update_all_read.rs @@ -20,7 +20,95 @@ pub struct UpdateAllRead<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpdateAllReadStatus<'a> { + Request, + Accepted, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpdateAllReadStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Request => "request", + Self::Accepted => "accepted", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UpdateAllReadStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "request" => Self::Request, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpdateAllReadStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "request" => Self::Request, + "accepted" => Self::Accepted, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpdateAllReadStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpdateAllReadStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpdateAllReadStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpdateAllReadStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpdateAllReadStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpdateAllReadStatus<'_> { + type Output = UpdateAllReadStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + UpdateAllReadStatus::Request => UpdateAllReadStatus::Request, + UpdateAllReadStatus::Accepted => UpdateAllReadStatus::Accepted, + UpdateAllReadStatus::Other(v) => UpdateAllReadStatus::Other(v.into_static()), + } + } } #[jacquard_derive::lexicon] diff --git a/crates/weaver-api/src/chat_bsky/moderation/get_actor_metadata.rs b/crates/weaver-api/src/chat_bsky/moderation/get_actor_metadata.rs index 14c6aed..a8b792b 100644 --- a/crates/weaver-api/src/chat_bsky/moderation/get_actor_metadata.rs +++ b/crates/weaver-api/src/chat_bsky/moderation/get_actor_metadata.rs @@ -185,67 +185,67 @@ pub mod metadata_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Convos; type ConvosStarted; type MessagesSent; type MessagesReceived; + type Convos; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Convos = Unset; type ConvosStarted = Unset; type MessagesSent = Unset; type MessagesReceived = Unset; - } - ///State transition - sets the `convos` field to Set - pub struct SetConvos(PhantomData S>); - impl sealed::Sealed for SetConvos {} - impl State for SetConvos { - type Convos = Set; - type ConvosStarted = S::ConvosStarted; - type MessagesSent = S::MessagesSent; - type MessagesReceived = S::MessagesReceived; + type Convos = Unset; } ///State transition - sets the `convos_started` field to Set pub struct SetConvosStarted(PhantomData S>); impl sealed::Sealed for SetConvosStarted {} impl State for SetConvosStarted { - type Convos = S::Convos; type ConvosStarted = Set; type MessagesSent = S::MessagesSent; type MessagesReceived = S::MessagesReceived; + type Convos = S::Convos; } ///State transition - sets the `messages_sent` field to Set pub struct SetMessagesSent(PhantomData S>); impl sealed::Sealed for SetMessagesSent {} impl State for SetMessagesSent { - type Convos = S::Convos; type ConvosStarted = S::ConvosStarted; type MessagesSent = Set; type MessagesReceived = S::MessagesReceived; + type Convos = S::Convos; } ///State transition - sets the `messages_received` field to Set pub struct SetMessagesReceived(PhantomData S>); impl sealed::Sealed for SetMessagesReceived {} impl State for SetMessagesReceived { - type Convos = S::Convos; type ConvosStarted = S::ConvosStarted; type MessagesSent = S::MessagesSent; type MessagesReceived = Set; + type Convos = S::Convos; + } + ///State transition - sets the `convos` field to Set + pub struct SetConvos(PhantomData S>); + impl sealed::Sealed for SetConvos {} + impl State for SetConvos { + type ConvosStarted = S::ConvosStarted; + type MessagesSent = S::MessagesSent; + type MessagesReceived = S::MessagesReceived; + type Convos = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `convos` field - pub struct convos(()); ///Marker type for the `convos_started` field pub struct convos_started(()); ///Marker type for the `messages_sent` field pub struct messages_sent(()); ///Marker type for the `messages_received` field pub struct messages_received(()); + ///Marker type for the `convos` field + pub struct convos(()); } } @@ -358,10 +358,10 @@ where impl<'a, S> MetadataBuilder<'a, S> where S: metadata_state::State, - S::Convos: metadata_state::IsSet, S::ConvosStarted: metadata_state::IsSet, S::MessagesSent: metadata_state::IsSet, S::MessagesReceived: metadata_state::IsSet, + S::Convos: metadata_state::IsSet, { /// Build the final struct pub fn build(self) -> Metadata<'a> { @@ -402,7 +402,7 @@ fn lexicon_doc_chat_bsky_moderation_getActorMetadata() -> ::jacquard_lexicon::le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -417,7 +417,7 @@ fn lexicon_doc_chat_bsky_moderation_getActorMetadata() -> ::jacquard_lexicon::le ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -458,7 +458,7 @@ fn lexicon_doc_chat_bsky_moderation_getActorMetadata() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("convos"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -530,7 +530,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Metadata<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/admin.rs b/crates/weaver-api/src/com_atproto/admin.rs index aedf3f7..e2f86b6 100644 --- a/crates/weaver-api/src/com_atproto/admin.rs +++ b/crates/weaver-api/src/com_atproto/admin.rs @@ -81,50 +81,50 @@ pub mod account_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Handle; - type IndexedAt; type Did; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Handle = Unset; - type IndexedAt = Unset; type Did = Unset; + type IndexedAt = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type Handle = Set; - type IndexedAt = S::IndexedAt; - type Did = S::Did; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Handle = S::Handle; - type IndexedAt = Set; type Did = S::Did; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Handle = S::Handle; - type IndexedAt = S::IndexedAt; type Did = Set; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type Handle = S::Handle; + type Did = S::Did; + type IndexedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `handle` field pub struct handle(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -402,8 +402,8 @@ impl<'a, S> AccountViewBuilder<'a, S> where S: account_view_state::State, S::Handle: account_view_state::IsSet, - S::IndexedAt: account_view_state::IsSet, S::Did: account_view_state::IsSet, + S::IndexedAt: account_view_state::IsSet, { /// Build the final struct pub fn build(self) -> AccountView<'a> { @@ -458,7 +458,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accountView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -473,7 +473,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "deactivatedAt", @@ -678,7 +678,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -746,7 +746,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -778,7 +778,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("applied"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -819,7 +819,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("property"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -871,7 +871,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1071,7 +1071,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoBlobRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1209,7 +1209,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1368,7 +1368,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StatusAttr<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1404,7 +1404,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreatSignature<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/admin/send_email.rs b/crates/weaver-api/src/com_atproto/admin/send_email.rs index 47b3dfe..3d4338a 100644 --- a/crates/weaver-api/src/com_atproto/admin/send_email.rs +++ b/crates/weaver-api/src/com_atproto/admin/send_email.rs @@ -42,51 +42,51 @@ pub mod send_email_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type RecipientDid; type Content; type SenderDid; + type RecipientDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type RecipientDid = Unset; type Content = Unset; type SenderDid = Unset; - } - ///State transition - sets the `recipient_did` field to Set - pub struct SetRecipientDid(PhantomData S>); - impl sealed::Sealed for SetRecipientDid {} - impl State for SetRecipientDid { - type RecipientDid = Set; - type Content = S::Content; - type SenderDid = S::SenderDid; + type RecipientDid = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { - type RecipientDid = S::RecipientDid; type Content = Set; type SenderDid = S::SenderDid; + type RecipientDid = S::RecipientDid; } ///State transition - sets the `sender_did` field to Set pub struct SetSenderDid(PhantomData S>); impl sealed::Sealed for SetSenderDid {} impl State for SetSenderDid { - type RecipientDid = S::RecipientDid; type Content = S::Content; type SenderDid = Set; + type RecipientDid = S::RecipientDid; + } + ///State transition - sets the `recipient_did` field to Set + pub struct SetRecipientDid(PhantomData S>); + impl sealed::Sealed for SetRecipientDid {} + impl State for SetRecipientDid { + type Content = S::Content; + type SenderDid = S::SenderDid; + type RecipientDid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `recipient_did` field - pub struct recipient_did(()); ///Marker type for the `content` field pub struct content(()); ///Marker type for the `sender_did` field pub struct sender_did(()); + ///Marker type for the `recipient_did` field + pub struct recipient_did(()); } } @@ -213,9 +213,9 @@ impl<'a, S: send_email_state::State> SendEmailBuilder<'a, S> { impl<'a, S> SendEmailBuilder<'a, S> where S: send_email_state::State, - S::RecipientDid: send_email_state::IsSet, S::Content: send_email_state::IsSet, S::SenderDid: send_email_state::IsSet, + S::RecipientDid: send_email_state::IsSet, { /// Build the final struct pub fn build(self) -> SendEmail<'a> { diff --git a/crates/weaver-api/src/com_atproto/admin/update_account_email.rs b/crates/weaver-api/src/com_atproto/admin/update_account_email.rs index 24aebdc..cf27c63 100644 --- a/crates/weaver-api/src/com_atproto/admin/update_account_email.rs +++ b/crates/weaver-api/src/com_atproto/admin/update_account_email.rs @@ -34,37 +34,37 @@ pub mod update_account_email_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Email; type Account; + type Email; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Email = Unset; type Account = Unset; - } - ///State transition - sets the `email` field to Set - pub struct SetEmail(PhantomData S>); - impl sealed::Sealed for SetEmail {} - impl State for SetEmail { - type Email = Set; - type Account = S::Account; + type Email = Unset; } ///State transition - sets the `account` field to Set pub struct SetAccount(PhantomData S>); impl sealed::Sealed for SetAccount {} impl State for SetAccount { - type Email = S::Email; type Account = Set; + type Email = S::Email; + } + ///State transition - sets the `email` field to Set + pub struct SetEmail(PhantomData S>); + impl sealed::Sealed for SetEmail {} + impl State for SetEmail { + type Account = S::Account; + type Email = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `email` field - pub struct email(()); ///Marker type for the `account` field pub struct account(()); + ///Marker type for the `email` field + pub struct email(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> UpdateAccountEmailBuilder<'a, S> where S: update_account_email_state::State, - S::Email: update_account_email_state::IsSet, S::Account: update_account_email_state::IsSet, + S::Email: update_account_email_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateAccountEmail<'a> { diff --git a/crates/weaver-api/src/com_atproto/admin/update_account_handle.rs b/crates/weaver-api/src/com_atproto/admin/update_account_handle.rs index edb8971..021ff61 100644 --- a/crates/weaver-api/src/com_atproto/admin/update_account_handle.rs +++ b/crates/weaver-api/src/com_atproto/admin/update_account_handle.rs @@ -33,37 +33,37 @@ pub mod update_account_handle_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle(PhantomData S>); - impl sealed::Sealed for SetHandle {} - impl State for SetHandle { - type Handle = Set; - type Did = S::Did; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Handle = S::Handle; type Did = Set; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle(PhantomData S>); + impl sealed::Sealed for SetHandle {} + impl State for SetHandle { + type Did = S::Did; + type Handle = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> UpdateAccountHandleBuilder<'a, S> where S: update_account_handle_state::State, - S::Handle: update_account_handle_state::IsSet, S::Did: update_account_handle_state::IsSet, + S::Handle: update_account_handle_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateAccountHandle<'a> { diff --git a/crates/weaver-api/src/com_atproto/identity.rs b/crates/weaver-api/src/com_atproto/identity.rs index 6e752d0..26d7ab3 100644 --- a/crates/weaver-api/src/com_atproto/identity.rs +++ b/crates/weaver-api/src/com_atproto/identity.rs @@ -223,7 +223,7 @@ fn lexicon_doc_com_atproto_identity_defs() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("identityInfo"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -238,7 +238,7 @@ fn lexicon_doc_com_atproto_identity_defs() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -304,7 +304,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for IdentityInfo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/identity/refresh_identity.rs b/crates/weaver-api/src/com_atproto/identity/refresh_identity.rs index baab0fe..39635ec 100644 --- a/crates/weaver-api/src/com_atproto/identity/refresh_identity.rs +++ b/crates/weaver-api/src/com_atproto/identity/refresh_identity.rs @@ -169,8 +169,8 @@ pub enum RefreshIdentityError<'a> { DidDeactivated(std::option::Option>), } -impl std::fmt::Display for RefreshIdentityError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for RefreshIdentityError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HandleNotFound(msg) => { write!(f, "HandleNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/identity/resolve_did.rs b/crates/weaver-api/src/com_atproto/identity/resolve_did.rs index 809fcbc..b420fab 100644 --- a/crates/weaver-api/src/com_atproto/identity/resolve_did.rs +++ b/crates/weaver-api/src/com_atproto/identity/resolve_did.rs @@ -151,8 +151,8 @@ pub enum ResolveDidError<'a> { DidDeactivated(std::option::Option>), } -impl std::fmt::Display for ResolveDidError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveDidError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::DidNotFound(msg) => { write!(f, "DidNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/identity/resolve_handle.rs b/crates/weaver-api/src/com_atproto/identity/resolve_handle.rs index f5dbebc..8b4ca59 100644 --- a/crates/weaver-api/src/com_atproto/identity/resolve_handle.rs +++ b/crates/weaver-api/src/com_atproto/identity/resolve_handle.rs @@ -147,8 +147,8 @@ pub enum ResolveHandleError<'a> { HandleNotFound(std::option::Option>), } -impl std::fmt::Display for ResolveHandleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveHandleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HandleNotFound(msg) => { write!(f, "HandleNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/identity/resolve_identity.rs b/crates/weaver-api/src/com_atproto/identity/resolve_identity.rs index 2bcfc9c..1ecc2ba 100644 --- a/crates/weaver-api/src/com_atproto/identity/resolve_identity.rs +++ b/crates/weaver-api/src/com_atproto/identity/resolve_identity.rs @@ -154,8 +154,8 @@ pub enum ResolveIdentityError<'a> { DidDeactivated(std::option::Option>), } -impl std::fmt::Display for ResolveIdentityError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveIdentityError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HandleNotFound(msg) => { write!(f, "HandleNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/label.rs b/crates/weaver-api/src/com_atproto/label.rs index 5ce5c00..2a0fec2 100644 --- a/crates/weaver-api/src/com_atproto/label.rs +++ b/crates/weaver-api/src/com_atproto/label.rs @@ -63,67 +63,67 @@ pub mod label_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Src; - type Cts; + type Uri; type Val; + type Cts; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Src = Unset; - type Cts = Unset; + type Uri = Unset; type Val = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Src = S::Src; - type Cts = S::Cts; - type Val = S::Val; + type Cts = Unset; } ///State transition - sets the `src` field to Set pub struct SetSrc(PhantomData S>); impl sealed::Sealed for SetSrc {} impl State for SetSrc { - type Uri = S::Uri; type Src = Set; - type Cts = S::Cts; + type Uri = S::Uri; type Val = S::Val; + type Cts = S::Cts; } - ///State transition - sets the `cts` field to Set - pub struct SetCts(PhantomData S>); - impl sealed::Sealed for SetCts {} - impl State for SetCts { - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { type Src = S::Src; - type Cts = Set; + type Uri = Set; type Val = S::Val; + type Cts = S::Cts; } ///State transition - sets the `val` field to Set pub struct SetVal(PhantomData S>); impl sealed::Sealed for SetVal {} impl State for SetVal { - type Uri = S::Uri; type Src = S::Src; - type Cts = S::Cts; + type Uri = S::Uri; type Val = Set; + type Cts = S::Cts; + } + ///State transition - sets the `cts` field to Set + pub struct SetCts(PhantomData S>); + impl sealed::Sealed for SetCts {} + impl State for SetCts { + type Src = S::Src; + type Uri = S::Uri; + type Val = S::Val; + type Cts = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `src` field pub struct src(()); - ///Marker type for the `cts` field - pub struct cts(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `val` field pub struct val(()); + ///Marker type for the `cts` field + pub struct cts(()); } } @@ -328,10 +328,10 @@ impl<'a, S: label_state::State> LabelBuilder<'a, S> { impl<'a, S> LabelBuilder<'a, S> where S: label_state::State, - S::Uri: label_state::IsSet, S::Src: label_state::IsSet, - S::Cts: label_state::IsSet, + S::Uri: label_state::IsSet, S::Val: label_state::IsSet, + S::Cts: label_state::IsSet, { /// Build the final struct pub fn build(self) -> Label<'a> { @@ -380,7 +380,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("label"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -400,7 +400,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -590,7 +590,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "adultOnly", @@ -719,7 +719,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -799,7 +799,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("val"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -837,7 +837,7 @@ fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("values"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -871,7 +871,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Label<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.val; #[allow(unused_comparisons)] @@ -968,6 +968,12 @@ impl<'a> AsRef for LabelValue<'a> { } } +impl<'a> core::fmt::Display for LabelValue<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for LabelValue<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1028,11 +1034,11 @@ pub struct LabelValueDefinition<'a> { pub adult_only: std::option::Option, /// What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. #[serde(borrow)] - pub blurs: jacquard_common::CowStr<'a>, + pub blurs: LabelValueDefinitionBlurs<'a>, /// The default setting for this label. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub default_setting: std::option::Option>, + pub default_setting: std::option::Option>, /// The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). #[serde(borrow)] pub identifier: jacquard_common::CowStr<'a>, @@ -1040,7 +1046,7 @@ pub struct LabelValueDefinition<'a> { pub locales: Vec>, /// How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. #[serde(borrow)] - pub severity: jacquard_common::CowStr<'a>, + pub severity: LabelValueDefinitionSeverity<'a>, } pub mod label_value_definition_state { @@ -1053,67 +1059,67 @@ pub mod label_value_definition_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Identifier; - type Blurs; type Severity; + type Identifier; type Locales; + type Blurs; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Identifier = Unset; - type Blurs = Unset; type Severity = Unset; + type Identifier = Unset; type Locales = Unset; - } - ///State transition - sets the `identifier` field to Set - pub struct SetIdentifier(PhantomData S>); - impl sealed::Sealed for SetIdentifier {} - impl State for SetIdentifier { - type Identifier = Set; - type Blurs = S::Blurs; - type Severity = S::Severity; - type Locales = S::Locales; - } - ///State transition - sets the `blurs` field to Set - pub struct SetBlurs(PhantomData S>); - impl sealed::Sealed for SetBlurs {} - impl State for SetBlurs { - type Identifier = S::Identifier; - type Blurs = Set; - type Severity = S::Severity; - type Locales = S::Locales; + type Blurs = Unset; } ///State transition - sets the `severity` field to Set pub struct SetSeverity(PhantomData S>); impl sealed::Sealed for SetSeverity {} impl State for SetSeverity { + type Severity = Set; type Identifier = S::Identifier; + type Locales = S::Locales; type Blurs = S::Blurs; - type Severity = Set; + } + ///State transition - sets the `identifier` field to Set + pub struct SetIdentifier(PhantomData S>); + impl sealed::Sealed for SetIdentifier {} + impl State for SetIdentifier { + type Severity = S::Severity; + type Identifier = Set; type Locales = S::Locales; + type Blurs = S::Blurs; } ///State transition - sets the `locales` field to Set pub struct SetLocales(PhantomData S>); impl sealed::Sealed for SetLocales {} impl State for SetLocales { + type Severity = S::Severity; type Identifier = S::Identifier; + type Locales = Set; type Blurs = S::Blurs; + } + ///State transition - sets the `blurs` field to Set + pub struct SetBlurs(PhantomData S>); + impl sealed::Sealed for SetBlurs {} + impl State for SetBlurs { type Severity = S::Severity; - type Locales = Set; + type Identifier = S::Identifier; + type Locales = S::Locales; + type Blurs = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `identifier` field - pub struct identifier(()); - ///Marker type for the `blurs` field - pub struct blurs(()); ///Marker type for the `severity` field pub struct severity(()); + ///Marker type for the `identifier` field + pub struct identifier(()); ///Marker type for the `locales` field pub struct locales(()); + ///Marker type for the `blurs` field + pub struct blurs(()); } } @@ -1122,13 +1128,13 @@ pub struct LabelValueDefinitionBuilder<'a, S: label_value_definition_state::Stat _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option< Vec>, >, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -1175,7 +1181,7 @@ where /// Set the `blurs` field (required) pub fn blurs( mut self, - value: impl Into>, + value: impl Into>, ) -> LabelValueDefinitionBuilder<'a, label_value_definition_state::SetBlurs> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); LabelValueDefinitionBuilder { @@ -1190,7 +1196,7 @@ impl<'a, S: label_value_definition_state::State> LabelValueDefinitionBuilder<'a, /// Set the `defaultSetting` field (optional) pub fn default_setting( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -1198,7 +1204,7 @@ impl<'a, S: label_value_definition_state::State> LabelValueDefinitionBuilder<'a, /// Set the `defaultSetting` field to an Option value (optional) pub fn maybe_default_setting( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -1254,7 +1260,7 @@ where /// Set the `severity` field (required) pub fn severity( mut self, - value: impl Into>, + value: impl Into>, ) -> LabelValueDefinitionBuilder<'a, label_value_definition_state::SetSeverity> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); LabelValueDefinitionBuilder { @@ -1268,10 +1274,10 @@ where impl<'a, S> LabelValueDefinitionBuilder<'a, S> where S: label_value_definition_state::State, - S::Identifier: label_value_definition_state::IsSet, - S::Blurs: label_value_definition_state::IsSet, S::Severity: label_value_definition_state::IsSet, + S::Identifier: label_value_definition_state::IsSet, S::Locales: label_value_definition_state::IsSet, + S::Blurs: label_value_definition_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelValueDefinition<'a> { @@ -1305,6 +1311,300 @@ where } } +/// What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum LabelValueDefinitionBlurs<'a> { + Content, + Media, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> LabelValueDefinitionBlurs<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Content => "content", + Self::Media => "media", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for LabelValueDefinitionBlurs<'a> { + fn from(s: &'a str) -> Self { + match s { + "content" => Self::Content, + "media" => Self::Media, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for LabelValueDefinitionBlurs<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "content" => Self::Content, + "media" => Self::Media, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for LabelValueDefinitionBlurs<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for LabelValueDefinitionBlurs<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for LabelValueDefinitionBlurs<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for LabelValueDefinitionBlurs<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for LabelValueDefinitionBlurs<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for LabelValueDefinitionBlurs<'_> { + type Output = LabelValueDefinitionBlurs<'static>; + fn into_static(self) -> Self::Output { + match self { + LabelValueDefinitionBlurs::Content => LabelValueDefinitionBlurs::Content, + LabelValueDefinitionBlurs::Media => LabelValueDefinitionBlurs::Media, + LabelValueDefinitionBlurs::None => LabelValueDefinitionBlurs::None, + LabelValueDefinitionBlurs::Other(v) => { + LabelValueDefinitionBlurs::Other(v.into_static()) + } + } + } +} + +/// The default setting for this label. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum LabelValueDefinitionDefaultSetting<'a> { + Ignore, + Warn, + Hide, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> LabelValueDefinitionDefaultSetting<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Ignore => "ignore", + Self::Warn => "warn", + Self::Hide => "hide", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for LabelValueDefinitionDefaultSetting<'a> { + fn from(s: &'a str) -> Self { + match s { + "ignore" => Self::Ignore, + "warn" => Self::Warn, + "hide" => Self::Hide, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for LabelValueDefinitionDefaultSetting<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "ignore" => Self::Ignore, + "warn" => Self::Warn, + "hide" => Self::Hide, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for LabelValueDefinitionDefaultSetting<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for LabelValueDefinitionDefaultSetting<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for LabelValueDefinitionDefaultSetting<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for LabelValueDefinitionDefaultSetting<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for LabelValueDefinitionDefaultSetting<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for LabelValueDefinitionDefaultSetting<'_> { + type Output = LabelValueDefinitionDefaultSetting<'static>; + fn into_static(self) -> Self::Output { + match self { + LabelValueDefinitionDefaultSetting::Ignore => { + LabelValueDefinitionDefaultSetting::Ignore + } + LabelValueDefinitionDefaultSetting::Warn => { + LabelValueDefinitionDefaultSetting::Warn + } + LabelValueDefinitionDefaultSetting::Hide => { + LabelValueDefinitionDefaultSetting::Hide + } + LabelValueDefinitionDefaultSetting::Other(v) => { + LabelValueDefinitionDefaultSetting::Other(v.into_static()) + } + } + } +} + +/// How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum LabelValueDefinitionSeverity<'a> { + Inform, + Alert, + None, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> LabelValueDefinitionSeverity<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Inform => "inform", + Self::Alert => "alert", + Self::None => "none", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for LabelValueDefinitionSeverity<'a> { + fn from(s: &'a str) -> Self { + match s { + "inform" => Self::Inform, + "alert" => Self::Alert, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for LabelValueDefinitionSeverity<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "inform" => Self::Inform, + "alert" => Self::Alert, + "none" => Self::None, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for LabelValueDefinitionSeverity<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for LabelValueDefinitionSeverity<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for LabelValueDefinitionSeverity<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for LabelValueDefinitionSeverity<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for LabelValueDefinitionSeverity<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for LabelValueDefinitionSeverity<'_> { + type Output = LabelValueDefinitionSeverity<'static>; + fn into_static(self) -> Self::Output { + match self { + LabelValueDefinitionSeverity::Inform => LabelValueDefinitionSeverity::Inform, + LabelValueDefinitionSeverity::Alert => LabelValueDefinitionSeverity::Alert, + LabelValueDefinitionSeverity::None => LabelValueDefinitionSeverity::None, + LabelValueDefinitionSeverity::Other(v) => { + LabelValueDefinitionSeverity::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelValueDefinition<'a> { fn nsid() -> &'static str { "com.atproto.label.defs" @@ -1317,7 +1617,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelValueDefinition<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.identifier; #[allow(unused_comparisons)] @@ -1387,51 +1687,51 @@ pub mod label_value_definition_strings_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Lang; - type Description; type Name; + type Description; + type Lang; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Lang = Unset; - type Description = Unset; type Name = Unset; + type Description = Unset; + type Lang = Unset; } - ///State transition - sets the `lang` field to Set - pub struct SetLang(PhantomData S>); - impl sealed::Sealed for SetLang {} - impl State for SetLang { - type Lang = Set; + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Name = Set; type Description = S::Description; - type Name = S::Name; + type Lang = S::Lang; } ///State transition - sets the `description` field to Set pub struct SetDescription(PhantomData S>); impl sealed::Sealed for SetDescription {} impl State for SetDescription { - type Lang = S::Lang; - type Description = Set; type Name = S::Name; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { + type Description = Set; type Lang = S::Lang; + } + ///State transition - sets the `lang` field to Set + pub struct SetLang(PhantomData S>); + impl sealed::Sealed for SetLang {} + impl State for SetLang { + type Name = S::Name; type Description = S::Description; - type Name = Set; + type Lang = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `lang` field - pub struct lang(()); - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `lang` field + pub struct lang(()); } } @@ -1541,9 +1841,9 @@ where impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S> where S: label_value_definition_strings_state::State, - S::Lang: label_value_definition_strings_state::IsSet, - S::Description: label_value_definition_strings_state::IsSet, S::Name: label_value_definition_strings_state::IsSet, + S::Description: label_value_definition_strings_state::IsSet, + S::Lang: label_value_definition_strings_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelValueDefinitionStrings<'a> { @@ -1583,7 +1883,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelValueDefinitionStrin } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.description; #[allow(unused_comparisons)] @@ -1683,7 +1983,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabel<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.val; #[allow(unused_comparisons)] @@ -1835,7 +2135,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabels<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.values; #[allow(unused_comparisons)] diff --git a/crates/weaver-api/src/com_atproto/label/subscribe_labels.rs b/crates/weaver-api/src/com_atproto/label/subscribe_labels.rs index c95a22e..2e30cc0 100644 --- a/crates/weaver-api/src/com_atproto/label/subscribe_labels.rs +++ b/crates/weaver-api/src/com_atproto/label/subscribe_labels.rs @@ -22,7 +22,90 @@ pub struct Info<'a> { #[serde(borrow)] pub message: std::option::Option>, #[serde(borrow)] - pub name: jacquard_common::CowStr<'a>, + pub name: InfoName<'a>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum InfoName<'a> { + OutdatedCursor, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> InfoName<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::OutdatedCursor => "OutdatedCursor", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for InfoName<'a> { + fn from(s: &'a str) -> Self { + match s { + "OutdatedCursor" => Self::OutdatedCursor, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for InfoName<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "OutdatedCursor" => Self::OutdatedCursor, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for InfoName<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for InfoName<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for InfoName<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for InfoName<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for InfoName<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for InfoName<'_> { + type Output = InfoName<'static>; + fn into_static(self) -> Self::Output { + match self { + InfoName::OutdatedCursor => InfoName::OutdatedCursor, + InfoName::Other(v) => InfoName::Other(v.into_static()), + } + } } fn lexicon_doc_com_atproto_label_subscribeLabels() -> ::jacquard_lexicon::lexicon::LexiconDoc< @@ -34,7 +117,7 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("info"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -45,7 +128,7 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("message"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -93,7 +176,7 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("labels"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -133,7 +216,7 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> ::jacquard_lexicon::lexico required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -171,7 +254,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Info<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -203,37 +286,37 @@ pub mod labels_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Labels; type Seq; + type Labels; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Labels = Unset; type Seq = Unset; - } - ///State transition - sets the `labels` field to Set - pub struct SetLabels(PhantomData S>); - impl sealed::Sealed for SetLabels {} - impl State for SetLabels { - type Labels = Set; - type Seq = S::Seq; + type Labels = Unset; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData S>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { - type Labels = S::Labels; type Seq = Set; + type Labels = S::Labels; + } + ///State transition - sets the `labels` field to Set + pub struct SetLabels(PhantomData S>); + impl sealed::Sealed for SetLabels {} + impl State for SetLabels { + type Seq = S::Seq; + type Labels = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `labels` field - pub struct labels(()); ///Marker type for the `seq` field pub struct seq(()); + ///Marker type for the `labels` field + pub struct labels(()); } } @@ -306,8 +389,8 @@ where impl<'a, S> LabelsBuilder<'a, S> where S: labels_state::State, - S::Labels: labels_state::IsSet, S::Seq: labels_state::IsSet, + S::Labels: labels_state::IsSet, { /// Build the final struct pub fn build(self) -> Labels<'a> { @@ -345,7 +428,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Labels<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -496,8 +579,8 @@ pub enum SubscribeLabelsError<'a> { FutureCursor(std::option::Option>), } -impl std::fmt::Display for SubscribeLabelsError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SubscribeLabelsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::FutureCursor(msg) => { write!(f, "FutureCursor")?; diff --git a/crates/weaver-api/src/com_atproto/lexicon/resolve_lexicon.rs b/crates/weaver-api/src/com_atproto/lexicon/resolve_lexicon.rs index c02beb8..c843531 100644 --- a/crates/weaver-api/src/com_atproto/lexicon/resolve_lexicon.rs +++ b/crates/weaver-api/src/com_atproto/lexicon/resolve_lexicon.rs @@ -154,8 +154,8 @@ pub enum ResolveLexiconError<'a> { LexiconNotFound(std::option::Option>), } -impl std::fmt::Display for ResolveLexiconError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveLexiconError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::LexiconNotFound(msg) => { write!(f, "LexiconNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/lexicon/schema.rs b/crates/weaver-api/src/com_atproto/lexicon/schema.rs index b8829f4..d849e78 100644 --- a/crates/weaver-api/src/com_atproto/lexicon/schema.rs +++ b/crates/weaver-api/src/com_atproto/lexicon/schema.rs @@ -198,7 +198,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Schema<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -212,7 +212,7 @@ fn lexicon_doc_com_atproto_lexicon_schema() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -232,7 +232,7 @@ fn lexicon_doc_com_atproto_lexicon_schema() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("lexicon"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { diff --git a/crates/weaver-api/src/com_atproto/moderation.rs b/crates/weaver-api/src/com_atproto/moderation.rs index 1ea1c59..8c81ec7 100644 --- a/crates/weaver-api/src/com_atproto/moderation.rs +++ b/crates/weaver-api/src/com_atproto/moderation.rs @@ -620,6 +620,12 @@ impl<'a> AsRef for ReasonType<'a> { } } +impl<'a> core::fmt::Display for ReasonType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ReasonType<'a> { fn serialize(&self, serializer: S) -> Result where @@ -858,6 +864,12 @@ impl<'a> AsRef for SubjectType<'a> { } } +impl<'a> core::fmt::Display for SubjectType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for SubjectType<'a> { fn serialize(&self, serializer: S) -> Result where diff --git a/crates/weaver-api/src/com_atproto/moderation/create_report.rs b/crates/weaver-api/src/com_atproto/moderation/create_report.rs index bdf6181..5768a05 100644 --- a/crates/weaver-api/src/com_atproto/moderation/create_report.rs +++ b/crates/weaver-api/src/com_atproto/moderation/create_report.rs @@ -343,7 +343,7 @@ fn lexicon_doc_com_atproto_moderation_createReport() -> ::jacquard_lexicon::lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcProcedure(::jacquard_lexicon::lexicon::LexXrpcProcedure { @@ -366,7 +366,7 @@ fn lexicon_doc_com_atproto_moderation_createReport() -> ::jacquard_lexicon::lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("modTool"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -438,7 +438,7 @@ fn lexicon_doc_com_atproto_moderation_createReport() -> ::jacquard_lexicon::lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("meta"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { @@ -485,7 +485,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModTool<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/repo.rs b/crates/weaver-api/src/com_atproto/repo.rs index c4326dc..9668377 100644 --- a/crates/weaver-api/src/com_atproto/repo.rs +++ b/crates/weaver-api/src/com_atproto/repo.rs @@ -44,37 +44,37 @@ pub mod commit_meta_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type Rev; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type Rev = Unset; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; - type Rev = S::Rev; + type Cid = Unset; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData S>); impl sealed::Sealed for SetRev {} impl State for SetRev { - type Cid = S::Cid; type Rev = Set; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Rev = S::Rev; + type Cid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `rev` field pub struct rev(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -147,8 +147,8 @@ where impl<'a, S> CommitMetaBuilder<'a, S> where S: commit_meta_state::State, - S::Cid: commit_meta_state::IsSet, S::Rev: commit_meta_state::IsSet, + S::Cid: commit_meta_state::IsSet, { /// Build the final struct pub fn build(self) -> CommitMeta<'a> { @@ -183,7 +183,7 @@ fn lexicon_doc_com_atproto_repo_defs() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("commitMeta"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -197,7 +197,7 @@ fn lexicon_doc_com_atproto_repo_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -253,7 +253,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CommitMeta<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/repo/apply_writes.rs b/crates/weaver-api/src/com_atproto/repo/apply_writes.rs index 14b9113..19ca337 100644 --- a/crates/weaver-api/src/com_atproto/repo/apply_writes.rs +++ b/crates/weaver-api/src/com_atproto/repo/apply_writes.rs @@ -42,37 +42,37 @@ pub mod create_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Value; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Value = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection(PhantomData S>); - impl sealed::Sealed for SetCollection {} - impl State for SetCollection { - type Collection = Set; - type Value = S::Value; + type Collection = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { - type Collection = S::Collection; type Value = Set; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection(PhantomData S>); + impl sealed::Sealed for SetCollection {} + impl State for SetCollection { + type Value = S::Value; + type Collection = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -179,8 +179,8 @@ where impl<'a, S> CreateBuilder<'a, S> where S: create_state::State, - S::Collection: create_state::IsSet, S::Value: create_state::IsSet, + S::Collection: create_state::IsSet, { /// Build the final struct pub fn build(self) -> Create<'a> { @@ -217,7 +217,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("create"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -235,7 +235,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collection", @@ -299,7 +299,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -372,7 +372,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collection", @@ -421,7 +421,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -448,7 +448,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("repo"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -547,7 +547,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collection", @@ -607,7 +607,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -680,7 +680,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Create<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.rkey { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 512usize { @@ -715,7 +715,7 @@ pub struct CreateResult<'a> { pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub validation_status: std::option::Option>, + pub validation_status: std::option::Option>, } pub mod create_result_state { @@ -728,37 +728,37 @@ pub mod create_result_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -768,7 +768,7 @@ pub struct CreateResultBuilder<'a, S: create_result_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -833,7 +833,7 @@ impl<'a, S: create_result_state::State> CreateResultBuilder<'a, S> { /// Set the `validationStatus` field (optional) pub fn validation_status( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -841,7 +841,7 @@ impl<'a, S: create_result_state::State> CreateResultBuilder<'a, S> { /// Set the `validationStatus` field to an Option value (optional) pub fn maybe_validation_status( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -851,8 +851,8 @@ impl<'a, S: create_result_state::State> CreateResultBuilder<'a, S> { impl<'a, S> CreateResultBuilder<'a, S> where S: create_result_state::State, - S::Uri: create_result_state::IsSet, S::Cid: create_result_state::IsSet, + S::Uri: create_result_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateResult<'a> { @@ -880,6 +880,98 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum CreateResultValidationStatus<'a> { + Valid, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> CreateResultValidationStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for CreateResultValidationStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for CreateResultValidationStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for CreateResultValidationStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for CreateResultValidationStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for CreateResultValidationStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for CreateResultValidationStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for CreateResultValidationStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for CreateResultValidationStatus<'_> { + type Output = CreateResultValidationStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + CreateResultValidationStatus::Valid => CreateResultValidationStatus::Valid, + CreateResultValidationStatus::Unknown => { + CreateResultValidationStatus::Unknown + } + CreateResultValidationStatus::Other(v) => { + CreateResultValidationStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CreateResult<'a> { fn nsid() -> &'static str { "com.atproto.repo.applyWrites" @@ -892,7 +984,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CreateResult<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -928,37 +1020,37 @@ pub mod delete_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Collection; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Collection = Unset; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey(PhantomData S>); - impl sealed::Sealed for SetRkey {} - impl State for SetRkey { - type Rkey = Set; - type Collection = S::Collection; + type Rkey = Unset; } ///State transition - sets the `collection` field to Set pub struct SetCollection(PhantomData S>); impl sealed::Sealed for SetCollection {} impl State for SetCollection { - type Rkey = S::Rkey; type Collection = Set; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey(PhantomData S>); + impl sealed::Sealed for SetRkey {} + impl State for SetRkey { + type Collection = S::Collection; + type Rkey = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -1039,8 +1131,8 @@ where impl<'a, S> DeleteBuilder<'a, S> where S: delete_state::State, - S::Rkey: delete_state::IsSet, S::Collection: delete_state::IsSet, + S::Rkey: delete_state::IsSet, { /// Build the final struct pub fn build(self) -> Delete<'a> { @@ -1078,7 +1170,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Delete<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1108,7 +1200,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DeleteResult<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1149,37 +1241,37 @@ pub mod apply_writes_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Writes; type Repo; + type Writes; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Writes = Unset; type Repo = Unset; - } - ///State transition - sets the `writes` field to Set - pub struct SetWrites(PhantomData S>); - impl sealed::Sealed for SetWrites {} - impl State for SetWrites { - type Writes = Set; - type Repo = S::Repo; + type Writes = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData S>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { - type Writes = S::Writes; type Repo = Set; + type Writes = S::Writes; + } + ///State transition - sets the `writes` field to Set + pub struct SetWrites(PhantomData S>); + impl sealed::Sealed for SetWrites {} + impl State for SetWrites { + type Repo = S::Repo; + type Writes = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `writes` field - pub struct writes(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `writes` field + pub struct writes(()); } } @@ -1286,8 +1378,8 @@ where impl<'a, S> ApplyWritesBuilder<'a, S> where S: apply_writes_state::State, - S::Writes: apply_writes_state::IsSet, S::Repo: apply_writes_state::IsSet, + S::Writes: apply_writes_state::IsSet, { /// Build the final struct pub fn build(self) -> ApplyWrites<'a> { @@ -1398,8 +1490,8 @@ pub enum ApplyWritesError<'a> { InvalidSwap(std::option::Option>), } -impl std::fmt::Display for ApplyWritesError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ApplyWritesError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidSwap(msg) => { write!(f, "InvalidSwap")?; @@ -1476,51 +1568,51 @@ pub mod update_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Value; type Rkey; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Value = Unset; type Rkey = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection(PhantomData S>); - impl sealed::Sealed for SetCollection {} - impl State for SetCollection { - type Collection = Set; - type Value = S::Value; - type Rkey = S::Rkey; + type Collection = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { - type Collection = S::Collection; type Value = Set; type Rkey = S::Rkey; + type Collection = S::Collection; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { - type Collection = S::Collection; type Value = S::Value; type Rkey = Set; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection(PhantomData S>); + impl sealed::Sealed for SetCollection {} + impl State for SetCollection { + type Value = S::Value; + type Rkey = S::Rkey; + type Collection = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `value` field pub struct value(()); ///Marker type for the `rkey` field pub struct rkey(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -1621,9 +1713,9 @@ where impl<'a, S> UpdateBuilder<'a, S> where S: update_state::State, - S::Collection: update_state::IsSet, S::Value: update_state::IsSet, S::Rkey: update_state::IsSet, + S::Collection: update_state::IsSet, { /// Build the final struct pub fn build(self) -> Update<'a> { @@ -1663,7 +1755,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Update<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1686,7 +1778,7 @@ pub struct UpdateResult<'a> { pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub validation_status: std::option::Option>, + pub validation_status: std::option::Option>, } pub mod update_result_state { @@ -1699,37 +1791,37 @@ pub mod update_result_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -1739,7 +1831,7 @@ pub struct UpdateResultBuilder<'a, S: update_result_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -1804,7 +1896,7 @@ impl<'a, S: update_result_state::State> UpdateResultBuilder<'a, S> { /// Set the `validationStatus` field (optional) pub fn validation_status( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -1812,7 +1904,7 @@ impl<'a, S: update_result_state::State> UpdateResultBuilder<'a, S> { /// Set the `validationStatus` field to an Option value (optional) pub fn maybe_validation_status( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -1822,8 +1914,8 @@ impl<'a, S: update_result_state::State> UpdateResultBuilder<'a, S> { impl<'a, S> UpdateResultBuilder<'a, S> where S: update_result_state::State, - S::Uri: update_result_state::IsSet, S::Cid: update_result_state::IsSet, + S::Uri: update_result_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateResult<'a> { @@ -1851,6 +1943,98 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpdateResultValidationStatus<'a> { + Valid, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpdateResultValidationStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UpdateResultValidationStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpdateResultValidationStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpdateResultValidationStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpdateResultValidationStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpdateResultValidationStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpdateResultValidationStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpdateResultValidationStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpdateResultValidationStatus<'_> { + type Output = UpdateResultValidationStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + UpdateResultValidationStatus::Valid => UpdateResultValidationStatus::Valid, + UpdateResultValidationStatus::Unknown => { + UpdateResultValidationStatus::Unknown + } + UpdateResultValidationStatus::Other(v) => { + UpdateResultValidationStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UpdateResult<'a> { fn nsid() -> &'static str { "com.atproto.repo.applyWrites" @@ -1863,7 +2047,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UpdateResult<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/repo/create_record.rs b/crates/weaver-api/src/com_atproto/repo/create_record.rs index 1398a9c..dbaf0b9 100644 --- a/crates/weaver-api/src/com_atproto/repo/create_record.rs +++ b/crates/weaver-api/src/com_atproto/repo/create_record.rs @@ -53,51 +53,51 @@ pub mod create_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; - type Collection; type Record; + type Collection; + type Repo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; - type Collection = Unset; type Record = Unset; + type Collection = Unset; + type Repo = Unset; } - ///State transition - sets the `repo` field to Set - pub struct SetRepo(PhantomData S>); - impl sealed::Sealed for SetRepo {} - impl State for SetRepo { - type Repo = Set; + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData S>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { + type Record = Set; type Collection = S::Collection; - type Record = S::Record; + type Repo = S::Repo; } ///State transition - sets the `collection` field to Set pub struct SetCollection(PhantomData S>); impl sealed::Sealed for SetCollection {} impl State for SetCollection { - type Repo = S::Repo; - type Collection = Set; type Record = S::Record; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord(PhantomData S>); - impl sealed::Sealed for SetRecord {} - impl State for SetRecord { + type Collection = Set; type Repo = S::Repo; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo(PhantomData S>); + impl sealed::Sealed for SetRepo {} + impl State for SetRepo { + type Record = S::Record; type Collection = S::Collection; - type Record = Set; + type Repo = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `collection` field + pub struct collection(()); + ///Marker type for the `repo` field + pub struct repo(()); } } @@ -258,9 +258,9 @@ impl<'a, S: create_record_state::State> CreateRecordBuilder<'a, S> { impl<'a, S> CreateRecordBuilder<'a, S> where S: create_record_state::State, - S::Repo: create_record_state::IsSet, - S::Collection: create_record_state::IsSet, S::Record: create_record_state::IsSet, + S::Collection: create_record_state::IsSet, + S::Repo: create_record_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateRecord<'a> { @@ -315,7 +315,101 @@ pub struct CreateRecordOutput<'a> { pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub validation_status: std::option::Option>, + pub validation_status: std::option::Option>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum CreateRecordOutputValidationStatus<'a> { + Valid, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> CreateRecordOutputValidationStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for CreateRecordOutputValidationStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for CreateRecordOutputValidationStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for CreateRecordOutputValidationStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for CreateRecordOutputValidationStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for CreateRecordOutputValidationStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for CreateRecordOutputValidationStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for CreateRecordOutputValidationStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for CreateRecordOutputValidationStatus<'_> { + type Output = CreateRecordOutputValidationStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + CreateRecordOutputValidationStatus::Valid => { + CreateRecordOutputValidationStatus::Valid + } + CreateRecordOutputValidationStatus::Unknown => { + CreateRecordOutputValidationStatus::Unknown + } + CreateRecordOutputValidationStatus::Other(v) => { + CreateRecordOutputValidationStatus::Other(v.into_static()) + } + } + } } #[jacquard_derive::open_union] @@ -338,8 +432,8 @@ pub enum CreateRecordError<'a> { InvalidSwap(std::option::Option>), } -impl std::fmt::Display for CreateRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidSwap(msg) => { write!(f, "InvalidSwap")?; diff --git a/crates/weaver-api/src/com_atproto/repo/delete_record.rs b/crates/weaver-api/src/com_atproto/repo/delete_record.rs index 3a51c64..c38096b 100644 --- a/crates/weaver-api/src/com_atproto/repo/delete_record.rs +++ b/crates/weaver-api/src/com_atproto/repo/delete_record.rs @@ -48,49 +48,49 @@ pub mod delete_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; type Collection; + type Repo; type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; type Collection = Unset; + type Repo = Unset; type Rkey = Unset; } - ///State transition - sets the `repo` field to Set - pub struct SetRepo(PhantomData S>); - impl sealed::Sealed for SetRepo {} - impl State for SetRepo { - type Repo = Set; - type Collection = S::Collection; - type Rkey = S::Rkey; - } ///State transition - sets the `collection` field to Set pub struct SetCollection(PhantomData S>); impl sealed::Sealed for SetCollection {} impl State for SetCollection { - type Repo = S::Repo; type Collection = Set; + type Repo = S::Repo; + type Rkey = S::Rkey; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo(PhantomData S>); + impl sealed::Sealed for SetRepo {} + impl State for SetRepo { + type Collection = S::Collection; + type Repo = Set; type Rkey = S::Rkey; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { - type Repo = S::Repo; type Collection = S::Collection; + type Repo = S::Repo; type Rkey = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `rkey` field pub struct rkey(()); } @@ -233,8 +233,8 @@ impl<'a, S: delete_record_state::State> DeleteRecordBuilder<'a, S> { impl<'a, S> DeleteRecordBuilder<'a, S> where S: delete_record_state::State, - S::Repo: delete_record_state::IsSet, S::Collection: delete_record_state::IsSet, + S::Repo: delete_record_state::IsSet, S::Rkey: delete_record_state::IsSet, { /// Build the final struct @@ -304,8 +304,8 @@ pub enum DeleteRecordError<'a> { InvalidSwap(std::option::Option>), } -impl std::fmt::Display for DeleteRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidSwap(msg) => { write!(f, "InvalidSwap")?; diff --git a/crates/weaver-api/src/com_atproto/repo/get_record.rs b/crates/weaver-api/src/com_atproto/repo/get_record.rs index 9e4cfd2..67a7396 100644 --- a/crates/weaver-api/src/com_atproto/repo/get_record.rs +++ b/crates/weaver-api/src/com_atproto/repo/get_record.rs @@ -40,50 +40,50 @@ pub mod get_record_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Rkey; - type Collection; type Repo; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Rkey = Unset; - type Collection = Unset; type Repo = Unset; + type Collection = Unset; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { type Rkey = Set; - type Collection = S::Collection; - type Repo = S::Repo; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection(PhantomData S>); - impl sealed::Sealed for SetCollection {} - impl State for SetCollection { - type Rkey = S::Rkey; - type Collection = Set; type Repo = S::Repo; + type Collection = S::Collection; } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData S>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { type Rkey = S::Rkey; - type Collection = S::Collection; type Repo = Set; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection(PhantomData S>); + impl sealed::Sealed for SetCollection {} + impl State for SetCollection { + type Rkey = S::Rkey; + type Repo = S::Repo; + type Collection = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `rkey` field pub struct rkey(()); - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -205,8 +205,8 @@ impl<'a, S> GetRecordBuilder<'a, S> where S: get_record_state::State, S::Rkey: get_record_state::IsSet, - S::Collection: get_record_state::IsSet, S::Repo: get_record_state::IsSet, + S::Collection: get_record_state::IsSet, { /// Build the final struct pub fn build(self) -> GetRecord<'a> { @@ -259,8 +259,8 @@ pub enum GetRecordError<'a> { RecordNotFound(std::option::Option>), } -impl std::fmt::Display for GetRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RecordNotFound(msg) => { write!(f, "RecordNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/repo/list_missing_blobs.rs b/crates/weaver-api/src/com_atproto/repo/list_missing_blobs.rs index 62c775e..3bc064e 100644 --- a/crates/weaver-api/src/com_atproto/repo/list_missing_blobs.rs +++ b/crates/weaver-api/src/com_atproto/repo/list_missing_blobs.rs @@ -325,7 +325,7 @@ fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -336,7 +336,7 @@ fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> ::jacquard_lexicon::lexico required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -384,7 +384,7 @@ fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -442,7 +442,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordBlob<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/repo/list_records.rs b/crates/weaver-api/src/com_atproto/repo/list_records.rs index 16572ca..b683462 100644 --- a/crates/weaver-api/src/com_atproto/repo/list_records.rs +++ b/crates/weaver-api/src/com_atproto/repo/list_records.rs @@ -40,37 +40,37 @@ pub mod list_records_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Repo; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Repo = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection(PhantomData S>); - impl sealed::Sealed for SetCollection {} - impl State for SetCollection { - type Collection = Set; - type Repo = S::Repo; + type Collection = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData S>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { - type Collection = S::Collection; type Repo = Set; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection(PhantomData S>); + impl sealed::Sealed for SetCollection {} + impl State for SetCollection { + type Repo = S::Repo; + type Collection = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -188,8 +188,8 @@ impl<'a, S: list_records_state::State> ListRecordsBuilder<'a, S> { impl<'a, S> ListRecordsBuilder<'a, S> where S: list_records_state::State, - S::Collection: list_records_state::IsSet, S::Repo: list_records_state::IsSet, + S::Collection: list_records_state::IsSet, { /// Build the final struct pub fn build(self) -> ListRecords<'a> { @@ -278,51 +278,51 @@ pub mod record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type Uri; type Value; + type Uri; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type Uri = Unset; type Value = Unset; + type Uri = Unset; + type Cid = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Value = Set; type Uri = S::Uri; - type Value = S::Value; + type Cid = S::Cid; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Cid = S::Cid; - type Uri = Set; type Value = S::Value; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { + type Uri = Set; type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Value = S::Value; type Uri = S::Uri; - type Value = Set; + type Cid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -415,9 +415,9 @@ where impl<'a, S> RecordBuilder<'a, S> where S: record_state::State, - S::Cid: record_state::IsSet, - S::Uri: record_state::IsSet, S::Value: record_state::IsSet, + S::Uri: record_state::IsSet, + S::Cid: record_state::IsSet, { /// Build the final struct pub fn build(self) -> Record<'a> { @@ -454,7 +454,7 @@ fn lexicon_doc_com_atproto_repo_listRecords() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -470,7 +470,7 @@ fn lexicon_doc_com_atproto_repo_listRecords() -> ::jacquard_lexicon::lexicon::Le ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collection", @@ -571,7 +571,7 @@ fn lexicon_doc_com_atproto_repo_listRecords() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -633,7 +633,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Record<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/repo/put_record.rs b/crates/weaver-api/src/com_atproto/repo/put_record.rs index 9687425..cc2325a 100644 --- a/crates/weaver-api/src/com_atproto/repo/put_record.rs +++ b/crates/weaver-api/src/com_atproto/repo/put_record.rs @@ -54,65 +54,65 @@ pub mod put_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; - type Record; type Repo; + type Record; + type Collection; type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; - type Record = Unset; type Repo = Unset; + type Record = Unset; + type Collection = Unset; type Rkey = Unset; } - ///State transition - sets the `collection` field to Set - pub struct SetCollection(PhantomData S>); - impl sealed::Sealed for SetCollection {} - impl State for SetCollection { - type Collection = Set; + ///State transition - sets the `repo` field to Set + pub struct SetRepo(PhantomData S>); + impl sealed::Sealed for SetRepo {} + impl State for SetRepo { + type Repo = Set; type Record = S::Record; - type Repo = S::Repo; + type Collection = S::Collection; type Rkey = S::Rkey; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Collection = S::Collection; - type Record = Set; type Repo = S::Repo; + type Record = Set; + type Collection = S::Collection; type Rkey = S::Rkey; } - ///State transition - sets the `repo` field to Set - pub struct SetRepo(PhantomData S>); - impl sealed::Sealed for SetRepo {} - impl State for SetRepo { - type Collection = S::Collection; + ///State transition - sets the `collection` field to Set + pub struct SetCollection(PhantomData S>); + impl sealed::Sealed for SetCollection {} + impl State for SetCollection { + type Repo = S::Repo; type Record = S::Record; - type Repo = Set; + type Collection = Set; type Rkey = S::Rkey; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { - type Collection = S::Collection; - type Record = S::Record; type Repo = S::Repo; + type Record = S::Record; + type Collection = S::Collection; type Rkey = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); - ///Marker type for the `record` field - pub struct record(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `collection` field + pub struct collection(()); ///Marker type for the `rkey` field pub struct rkey(()); } @@ -289,9 +289,9 @@ impl<'a, S: put_record_state::State> PutRecordBuilder<'a, S> { impl<'a, S> PutRecordBuilder<'a, S> where S: put_record_state::State, - S::Collection: put_record_state::IsSet, - S::Record: put_record_state::IsSet, S::Repo: put_record_state::IsSet, + S::Record: put_record_state::IsSet, + S::Collection: put_record_state::IsSet, S::Rkey: put_record_state::IsSet, { /// Build the final struct @@ -349,7 +349,101 @@ pub struct PutRecordOutput<'a> { pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub validation_status: std::option::Option>, + pub validation_status: std::option::Option>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum PutRecordOutputValidationStatus<'a> { + Valid, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> PutRecordOutputValidationStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Valid => "valid", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for PutRecordOutputValidationStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for PutRecordOutputValidationStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "valid" => Self::Valid, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for PutRecordOutputValidationStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for PutRecordOutputValidationStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for PutRecordOutputValidationStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for PutRecordOutputValidationStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for PutRecordOutputValidationStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for PutRecordOutputValidationStatus<'_> { + type Output = PutRecordOutputValidationStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + PutRecordOutputValidationStatus::Valid => { + PutRecordOutputValidationStatus::Valid + } + PutRecordOutputValidationStatus::Unknown => { + PutRecordOutputValidationStatus::Unknown + } + PutRecordOutputValidationStatus::Other(v) => { + PutRecordOutputValidationStatus::Other(v.into_static()) + } + } + } } #[jacquard_derive::open_union] @@ -371,8 +465,8 @@ pub enum PutRecordError<'a> { InvalidSwap(std::option::Option>), } -impl std::fmt::Display for PutRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for PutRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidSwap(msg) => { write!(f, "InvalidSwap")?; diff --git a/crates/weaver-api/src/com_atproto/repo/strong_ref.rs b/crates/weaver-api/src/com_atproto/repo/strong_ref.rs index 9a034c1..f934e76 100644 --- a/crates/weaver-api/src/com_atproto/repo/strong_ref.rs +++ b/crates/weaver-api/src/com_atproto/repo/strong_ref.rs @@ -172,7 +172,7 @@ fn lexicon_doc_com_atproto_repo_strongRef() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_com_atproto_repo_strongRef() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -242,7 +242,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StrongRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/server.rs b/crates/weaver-api/src/com_atproto/server.rs index 7225bf5..f70fa6e 100644 --- a/crates/weaver-api/src/com_atproto/server.rs +++ b/crates/weaver-api/src/com_atproto/server.rs @@ -67,126 +67,126 @@ pub mod invite_code_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Code; - type Available; type Disabled; + type Uses; + type CreatedAt; + type Available; type ForAccount; type CreatedBy; - type CreatedAt; - type Uses; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Code = Unset; - type Available = Unset; type Disabled = Unset; + type Uses = Unset; + type CreatedAt = Unset; + type Available = Unset; type ForAccount = Unset; type CreatedBy = Unset; - type CreatedAt = Unset; - type Uses = Unset; } ///State transition - sets the `code` field to Set pub struct SetCode(PhantomData S>); impl sealed::Sealed for SetCode {} impl State for SetCode { type Code = Set; - type Available = S::Available; type Disabled = S::Disabled; - type ForAccount = S::ForAccount; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; type Uses = S::Uses; - } - ///State transition - sets the `available` field to Set - pub struct SetAvailable(PhantomData S>); - impl sealed::Sealed for SetAvailable {} - impl State for SetAvailable { - type Code = S::Code; - type Available = Set; - type Disabled = S::Disabled; + type CreatedAt = S::CreatedAt; + type Available = S::Available; type ForAccount = S::ForAccount; type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Uses = S::Uses; } ///State transition - sets the `disabled` field to Set pub struct SetDisabled(PhantomData S>); impl sealed::Sealed for SetDisabled {} impl State for SetDisabled { type Code = S::Code; - type Available = S::Available; type Disabled = Set; + type Uses = S::Uses; + type CreatedAt = S::CreatedAt; + type Available = S::Available; type ForAccount = S::ForAccount; type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Uses = S::Uses; } - ///State transition - sets the `for_account` field to Set - pub struct SetForAccount(PhantomData S>); - impl sealed::Sealed for SetForAccount {} - impl State for SetForAccount { + ///State transition - sets the `uses` field to Set + pub struct SetUses(PhantomData S>); + impl sealed::Sealed for SetUses {} + impl State for SetUses { type Code = S::Code; - type Available = S::Available; type Disabled = S::Disabled; - type ForAccount = Set; - type CreatedBy = S::CreatedBy; + type Uses = Set; type CreatedAt = S::CreatedAt; - type Uses = S::Uses; - } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy(PhantomData S>); - impl sealed::Sealed for SetCreatedBy {} - impl State for SetCreatedBy { - type Code = S::Code; type Available = S::Available; - type Disabled = S::Disabled; type ForAccount = S::ForAccount; - type CreatedBy = Set; - type CreatedAt = S::CreatedAt; - type Uses = S::Uses; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Code = S::Code; - type Available = S::Available; type Disabled = S::Disabled; + type Uses = S::Uses; + type CreatedAt = Set; + type Available = S::Available; type ForAccount = S::ForAccount; type CreatedBy = S::CreatedBy; - type CreatedAt = Set; - type Uses = S::Uses; } - ///State transition - sets the `uses` field to Set - pub struct SetUses(PhantomData S>); - impl sealed::Sealed for SetUses {} - impl State for SetUses { + ///State transition - sets the `available` field to Set + pub struct SetAvailable(PhantomData S>); + impl sealed::Sealed for SetAvailable {} + impl State for SetAvailable { type Code = S::Code; - type Available = S::Available; type Disabled = S::Disabled; + type Uses = S::Uses; + type CreatedAt = S::CreatedAt; + type Available = Set; type ForAccount = S::ForAccount; type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `for_account` field to Set + pub struct SetForAccount(PhantomData S>); + impl sealed::Sealed for SetForAccount {} + impl State for SetForAccount { + type Code = S::Code; + type Disabled = S::Disabled; + type Uses = S::Uses; type CreatedAt = S::CreatedAt; - type Uses = Set; + type Available = S::Available; + type ForAccount = Set; + type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy(PhantomData S>); + impl sealed::Sealed for SetCreatedBy {} + impl State for SetCreatedBy { + type Code = S::Code; + type Disabled = S::Disabled; + type Uses = S::Uses; + type CreatedAt = S::CreatedAt; + type Available = S::Available; + type ForAccount = S::ForAccount; + type CreatedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `code` field pub struct code(()); - ///Marker type for the `available` field - pub struct available(()); ///Marker type for the `disabled` field pub struct disabled(()); + ///Marker type for the `uses` field + pub struct uses(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `available` field + pub struct available(()); ///Marker type for the `for_account` field pub struct for_account(()); ///Marker type for the `created_by` field pub struct created_by(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `uses` field - pub struct uses(()); } } @@ -360,12 +360,12 @@ impl<'a, S> InviteCodeBuilder<'a, S> where S: invite_code_state::State, S::Code: invite_code_state::IsSet, - S::Available: invite_code_state::IsSet, S::Disabled: invite_code_state::IsSet, + S::Uses: invite_code_state::IsSet, + S::CreatedAt: invite_code_state::IsSet, + S::Available: invite_code_state::IsSet, S::ForAccount: invite_code_state::IsSet, S::CreatedBy: invite_code_state::IsSet, - S::CreatedAt: invite_code_state::IsSet, - S::Uses: invite_code_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteCode<'a> { @@ -410,7 +410,7 @@ fn lexicon_doc_com_atproto_server_defs() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("inviteCode"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -429,7 +429,7 @@ fn lexicon_doc_com_atproto_server_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "available", @@ -550,7 +550,7 @@ fn lexicon_doc_com_atproto_server_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("usedAt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -606,7 +606,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteCode<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -780,7 +780,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteCodeUse<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/server/confirm_email.rs b/crates/weaver-api/src/com_atproto/server/confirm_email.rs index 49b6f1b..2e555f1 100644 --- a/crates/weaver-api/src/com_atproto/server/confirm_email.rs +++ b/crates/weaver-api/src/com_atproto/server/confirm_email.rs @@ -49,8 +49,8 @@ pub enum ConfirmEmailError<'a> { InvalidEmail(std::option::Option>), } -impl std::fmt::Display for ConfirmEmailError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ConfirmEmailError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountNotFound(msg) => { write!(f, "AccountNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/server/create_account.rs b/crates/weaver-api/src/com_atproto/server/create_account.rs index 512cde1..0d31e12 100644 --- a/crates/weaver-api/src/com_atproto/server/create_account.rs +++ b/crates/weaver-api/src/com_atproto/server/create_account.rs @@ -393,8 +393,8 @@ pub enum CreateAccountError<'a> { IncompatibleDidDoc(std::option::Option>), } -impl std::fmt::Display for CreateAccountError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateAccountError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidHandle(msg) => { write!(f, "InvalidHandle")?; diff --git a/crates/weaver-api/src/com_atproto/server/create_app_password.rs b/crates/weaver-api/src/com_atproto/server/create_app_password.rs index 9e3e4e9..446c4cf 100644 --- a/crates/weaver-api/src/com_atproto/server/create_app_password.rs +++ b/crates/weaver-api/src/com_atproto/server/create_app_password.rs @@ -36,49 +36,49 @@ pub mod app_password_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Password; + type Name; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Password = Unset; + type Name = Unset; type CreatedAt = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Name = Set; - type Password = S::Password; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `password` field to Set pub struct SetPassword(PhantomData S>); impl sealed::Sealed for SetPassword {} impl State for SetPassword { - type Name = S::Name; type Password = Set; + type Name = S::Name; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Password = S::Password; + type Name = Set; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Name = S::Name; type Password = S::Password; + type Name = S::Name; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `password` field pub struct password(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -187,8 +187,8 @@ impl<'a, S: app_password_state::State> AppPasswordBuilder<'a, S> { impl<'a, S> AppPasswordBuilder<'a, S> where S: app_password_state::State, - S::Name: app_password_state::IsSet, S::Password: app_password_state::IsSet, + S::Name: app_password_state::IsSet, S::CreatedAt: app_password_state::IsSet, { /// Build the final struct @@ -230,7 +230,7 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> ::jacquard_lexicon::lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("appPassword"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -245,7 +245,7 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -330,7 +330,7 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -386,7 +386,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AppPassword<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -448,8 +448,8 @@ pub enum CreateAppPasswordError<'a> { AccountTakedown(std::option::Option>), } -impl std::fmt::Display for CreateAppPasswordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateAppPasswordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; diff --git a/crates/weaver-api/src/com_atproto/server/create_invite_codes.rs b/crates/weaver-api/src/com_atproto/server/create_invite_codes.rs index 829d545..617d4ea 100644 --- a/crates/weaver-api/src/com_atproto/server/create_invite_codes.rs +++ b/crates/weaver-api/src/com_atproto/server/create_invite_codes.rs @@ -174,7 +174,7 @@ fn lexicon_doc_com_atproto_server_createInviteCodes() -> ::jacquard_lexicon::lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accountCodes"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -188,7 +188,7 @@ fn lexicon_doc_com_atproto_server_createInviteCodes() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("account"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -250,7 +250,7 @@ fn lexicon_doc_com_atproto_server_createInviteCodes() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "codeCount", @@ -327,7 +327,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountCodes<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -361,37 +361,37 @@ pub mod create_invite_codes_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UseCount; type CodeCount; + type UseCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UseCount = Unset; type CodeCount = Unset; - } - ///State transition - sets the `use_count` field to Set - pub struct SetUseCount(PhantomData S>); - impl sealed::Sealed for SetUseCount {} - impl State for SetUseCount { - type UseCount = Set; - type CodeCount = S::CodeCount; + type UseCount = Unset; } ///State transition - sets the `code_count` field to Set pub struct SetCodeCount(PhantomData S>); impl sealed::Sealed for SetCodeCount {} impl State for SetCodeCount { - type UseCount = S::UseCount; type CodeCount = Set; + type UseCount = S::UseCount; + } + ///State transition - sets the `use_count` field to Set + pub struct SetUseCount(PhantomData S>); + impl sealed::Sealed for SetUseCount {} + impl State for SetUseCount { + type CodeCount = S::CodeCount; + type UseCount = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `use_count` field - pub struct use_count(()); ///Marker type for the `code_count` field pub struct code_count(()); + ///Marker type for the `use_count` field + pub struct use_count(()); } } @@ -484,8 +484,8 @@ where impl<'a, S> CreateInviteCodesBuilder<'a, S> where S: create_invite_codes_state::State, - S::UseCount: create_invite_codes_state::IsSet, S::CodeCount: create_invite_codes_state::IsSet, + S::UseCount: create_invite_codes_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateInviteCodes<'a> { diff --git a/crates/weaver-api/src/com_atproto/server/create_session.rs b/crates/weaver-api/src/com_atproto/server/create_session.rs index 126cdee..1e86253 100644 --- a/crates/weaver-api/src/com_atproto/server/create_session.rs +++ b/crates/weaver-api/src/com_atproto/server/create_session.rs @@ -66,7 +66,105 @@ pub struct CreateSessionOutput<'a> { /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum CreateSessionOutputStatus<'a> { + Takendown, + Suspended, + Deactivated, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> CreateSessionOutputStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deactivated => "deactivated", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for CreateSessionOutputStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for CreateSessionOutputStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for CreateSessionOutputStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for CreateSessionOutputStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for CreateSessionOutputStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for CreateSessionOutputStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for CreateSessionOutputStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for CreateSessionOutputStatus<'_> { + type Output = CreateSessionOutputStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + CreateSessionOutputStatus::Takendown => CreateSessionOutputStatus::Takendown, + CreateSessionOutputStatus::Suspended => CreateSessionOutputStatus::Suspended, + CreateSessionOutputStatus::Deactivated => { + CreateSessionOutputStatus::Deactivated + } + CreateSessionOutputStatus::Other(v) => { + CreateSessionOutputStatus::Other(v.into_static()) + } + } + } } #[jacquard_derive::open_union] @@ -90,8 +188,8 @@ pub enum CreateSessionError<'a> { AuthFactorTokenRequired(std::option::Option>), } -impl std::fmt::Display for CreateSessionError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateSessionError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; diff --git a/crates/weaver-api/src/com_atproto/server/delete_account.rs b/crates/weaver-api/src/com_atproto/server/delete_account.rs index 178547b..2a365fe 100644 --- a/crates/weaver-api/src/com_atproto/server/delete_account.rs +++ b/crates/weaver-api/src/com_atproto/server/delete_account.rs @@ -35,51 +35,51 @@ pub mod delete_account_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Password; type Token; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Password = Unset; type Token = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - type Password = S::Password; - type Token = S::Token; + type Did = Unset; } ///State transition - sets the `password` field to Set pub struct SetPassword(PhantomData S>); impl sealed::Sealed for SetPassword {} impl State for SetPassword { - type Did = S::Did; type Password = Set; type Token = S::Token; + type Did = S::Did; } ///State transition - sets the `token` field to Set pub struct SetToken(PhantomData S>); impl sealed::Sealed for SetToken {} impl State for SetToken { - type Did = S::Did; type Password = S::Password; type Token = Set; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Password = S::Password; + type Token = S::Token; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `password` field pub struct password(()); ///Marker type for the `token` field pub struct token(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -172,9 +172,9 @@ where impl<'a, S> DeleteAccountBuilder<'a, S> where S: delete_account_state::State, - S::Did: delete_account_state::IsSet, S::Password: delete_account_state::IsSet, S::Token: delete_account_state::IsSet, + S::Did: delete_account_state::IsSet, { /// Build the final struct pub fn build(self) -> DeleteAccount<'a> { @@ -223,8 +223,8 @@ pub enum DeleteAccountError<'a> { InvalidToken(std::option::Option>), } -impl std::fmt::Display for DeleteAccountError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteAccountError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ExpiredToken(msg) => { write!(f, "ExpiredToken")?; diff --git a/crates/weaver-api/src/com_atproto/server/describe_server.rs b/crates/weaver-api/src/com_atproto/server/describe_server.rs index fb5bab1..d970160 100644 --- a/crates/weaver-api/src/com_atproto/server/describe_server.rs +++ b/crates/weaver-api/src/com_atproto/server/describe_server.rs @@ -32,7 +32,7 @@ fn lexicon_doc_com_atproto_server_describeServer() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("contact"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -41,7 +41,7 @@ fn lexicon_doc_com_atproto_server_describeServer() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("email"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -69,7 +69,7 @@ fn lexicon_doc_com_atproto_server_describeServer() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "privacyPolicy", @@ -138,7 +138,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Contact<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -176,7 +176,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Links<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/com_atproto/server/get_account_invite_codes.rs b/crates/weaver-api/src/com_atproto/server/get_account_invite_codes.rs index eb0a403..5bca636 100644 --- a/crates/weaver-api/src/com_atproto/server/get_account_invite_codes.rs +++ b/crates/weaver-api/src/com_atproto/server/get_account_invite_codes.rs @@ -140,8 +140,8 @@ pub enum GetAccountInviteCodesError<'a> { DuplicateCreate(std::option::Option>), } -impl std::fmt::Display for GetAccountInviteCodesError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetAccountInviteCodesError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::DuplicateCreate(msg) => { write!(f, "DuplicateCreate")?; diff --git a/crates/weaver-api/src/com_atproto/server/get_service_auth.rs b/crates/weaver-api/src/com_atproto/server/get_service_auth.rs index 5cf3b73..33a578b 100644 --- a/crates/weaver-api/src/com_atproto/server/get_service_auth.rs +++ b/crates/weaver-api/src/com_atproto/server/get_service_auth.rs @@ -189,8 +189,8 @@ pub enum GetServiceAuthError<'a> { BadExpiration(std::option::Option>), } -impl std::fmt::Display for GetServiceAuthError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetServiceAuthError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BadExpiration(msg) => { write!(f, "BadExpiration")?; diff --git a/crates/weaver-api/src/com_atproto/server/get_session.rs b/crates/weaver-api/src/com_atproto/server/get_session.rs index f12ea21..19bc8e6 100644 --- a/crates/weaver-api/src/com_atproto/server/get_session.rs +++ b/crates/weaver-api/src/com_atproto/server/get_session.rs @@ -36,7 +36,103 @@ pub struct GetSessionOutput<'a> { /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GetSessionOutputStatus<'a> { + Takendown, + Suspended, + Deactivated, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> GetSessionOutputStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deactivated => "deactivated", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for GetSessionOutputStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for GetSessionOutputStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for GetSessionOutputStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for GetSessionOutputStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for GetSessionOutputStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for GetSessionOutputStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for GetSessionOutputStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for GetSessionOutputStatus<'_> { + type Output = GetSessionOutputStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + GetSessionOutputStatus::Takendown => GetSessionOutputStatus::Takendown, + GetSessionOutputStatus::Suspended => GetSessionOutputStatus::Suspended, + GetSessionOutputStatus::Deactivated => GetSessionOutputStatus::Deactivated, + GetSessionOutputStatus::Other(v) => { + GetSessionOutputStatus::Other(v.into_static()) + } + } + } } /// XRPC request marker type diff --git a/crates/weaver-api/src/com_atproto/server/list_app_passwords.rs b/crates/weaver-api/src/com_atproto/server/list_app_passwords.rs index 87a7ad6..01aa0e5 100644 --- a/crates/weaver-api/src/com_atproto/server/list_app_passwords.rs +++ b/crates/weaver-api/src/com_atproto/server/list_app_passwords.rs @@ -189,7 +189,7 @@ fn lexicon_doc_com_atproto_server_listAppPasswords() -> ::jacquard_lexicon::lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("appPassword"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -203,7 +203,7 @@ fn lexicon_doc_com_atproto_server_listAppPasswords() -> ::jacquard_lexicon::lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -278,7 +278,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AppPassword<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -318,8 +318,8 @@ pub enum ListAppPasswordsError<'a> { AccountTakedown(std::option::Option>), } -impl std::fmt::Display for ListAppPasswordsError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ListAppPasswordsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; diff --git a/crates/weaver-api/src/com_atproto/server/refresh_session.rs b/crates/weaver-api/src/com_atproto/server/refresh_session.rs index b598431..263c5a5 100644 --- a/crates/weaver-api/src/com_atproto/server/refresh_session.rs +++ b/crates/weaver-api/src/com_atproto/server/refresh_session.rs @@ -33,7 +33,109 @@ pub struct RefreshSessionOutput<'a> { /// Hosting status of the account. If not specified, then assume 'active'. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +/// Hosting status of the account. If not specified, then assume 'active'. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RefreshSessionOutputStatus<'a> { + Takendown, + Suspended, + Deactivated, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RefreshSessionOutputStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deactivated => "deactivated", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RefreshSessionOutputStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RefreshSessionOutputStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deactivated" => Self::Deactivated, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RefreshSessionOutputStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RefreshSessionOutputStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RefreshSessionOutputStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RefreshSessionOutputStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RefreshSessionOutputStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RefreshSessionOutputStatus<'_> { + type Output = RefreshSessionOutputStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + RefreshSessionOutputStatus::Takendown => { + RefreshSessionOutputStatus::Takendown + } + RefreshSessionOutputStatus::Suspended => { + RefreshSessionOutputStatus::Suspended + } + RefreshSessionOutputStatus::Deactivated => { + RefreshSessionOutputStatus::Deactivated + } + RefreshSessionOutputStatus::Other(v) => { + RefreshSessionOutputStatus::Other(v.into_static()) + } + } + } } #[jacquard_derive::open_union] @@ -55,8 +157,8 @@ pub enum RefreshSessionError<'a> { AccountTakedown(std::option::Option>), } -impl std::fmt::Display for RefreshSessionError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for RefreshSessionError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; diff --git a/crates/weaver-api/src/com_atproto/server/reset_password.rs b/crates/weaver-api/src/com_atproto/server/reset_password.rs index 0d7a4c0..6653faf 100644 --- a/crates/weaver-api/src/com_atproto/server/reset_password.rs +++ b/crates/weaver-api/src/com_atproto/server/reset_password.rs @@ -45,8 +45,8 @@ pub enum ResetPasswordError<'a> { InvalidToken(std::option::Option>), } -impl std::fmt::Display for ResetPasswordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResetPasswordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ExpiredToken(msg) => { write!(f, "ExpiredToken")?; diff --git a/crates/weaver-api/src/com_atproto/server/update_email.rs b/crates/weaver-api/src/com_atproto/server/update_email.rs index 331cafb..64d1afa 100644 --- a/crates/weaver-api/src/com_atproto/server/update_email.rs +++ b/crates/weaver-api/src/com_atproto/server/update_email.rs @@ -51,8 +51,8 @@ pub enum UpdateEmailError<'a> { TokenRequired(std::option::Option>), } -impl std::fmt::Display for UpdateEmailError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for UpdateEmailError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ExpiredToken(msg) => { write!(f, "ExpiredToken")?; diff --git a/crates/weaver-api/src/com_atproto/sync.rs b/crates/weaver-api/src/com_atproto/sync.rs index 4983742..8cf4784 100644 --- a/crates/weaver-api/src/com_atproto/sync.rs +++ b/crates/weaver-api/src/com_atproto/sync.rs @@ -79,6 +79,12 @@ impl<'a> AsRef for HostStatus<'a> { } } +impl<'a> core::fmt::Display for HostStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for HostStatus<'a> { fn serialize(&self, serializer: S) -> Result where diff --git a/crates/weaver-api/src/com_atproto/sync/get_blob.rs b/crates/weaver-api/src/com_atproto/sync/get_blob.rs index 401e59f..19d72c4 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_blob.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_blob.rs @@ -32,37 +32,37 @@ pub mod get_blob_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Cid; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Cid = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - type Cid = S::Cid; + type Did = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Did = S::Did; type Cid = Set; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Cid = S::Cid; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetBlobBuilder<'a, S> where S: get_blob_state::State, - S::Did: get_blob_state::IsSet, S::Cid: get_blob_state::IsSet, + S::Did: get_blob_state::IsSet, { /// Build the final struct pub fn build(self) -> GetBlob<'a> { @@ -188,8 +188,8 @@ pub enum GetBlobError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for GetBlobError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetBlobError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BlobNotFound(msg) => { write!(f, "BlobNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_blocks.rs b/crates/weaver-api/src/com_atproto/sync/get_blocks.rs index ce9f890..4571bdb 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_blocks.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_blocks.rs @@ -32,37 +32,37 @@ pub mod get_blocks_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cids; type Did; + type Cids; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cids = Unset; type Did = Unset; - } - ///State transition - sets the `cids` field to Set - pub struct SetCids(PhantomData S>); - impl sealed::Sealed for SetCids {} - impl State for SetCids { - type Cids = Set; - type Did = S::Did; + type Cids = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Cids = S::Cids; type Did = Set; + type Cids = S::Cids; + } + ///State transition - sets the `cids` field to Set + pub struct SetCids(PhantomData S>); + impl sealed::Sealed for SetCids {} + impl State for SetCids { + type Did = S::Did; + type Cids = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cids` field - pub struct cids(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `cids` field + pub struct cids(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetBlocksBuilder<'a, S> where S: get_blocks_state::State, - S::Cids: get_blocks_state::IsSet, S::Did: get_blocks_state::IsSet, + S::Cids: get_blocks_state::IsSet, { /// Build the final struct pub fn build(self) -> GetBlocks<'a> { @@ -188,8 +188,8 @@ pub enum GetBlocksError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for GetBlocksError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetBlocksError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::BlockNotFound(msg) => { write!(f, "BlockNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_head.rs b/crates/weaver-api/src/com_atproto/sync/get_head.rs index d29b266..6376398 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_head.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_head.rs @@ -146,8 +146,8 @@ pub enum GetHeadError<'a> { HeadNotFound(std::option::Option>), } -impl std::fmt::Display for GetHeadError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetHeadError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HeadNotFound(msg) => { write!(f, "HeadNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_host_status.rs b/crates/weaver-api/src/com_atproto/sync/get_host_status.rs index b4efc3e..e625edf 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_host_status.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_host_status.rs @@ -154,8 +154,8 @@ pub enum GetHostStatusError<'a> { HostNotFound(std::option::Option>), } -impl std::fmt::Display for GetHostStatusError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetHostStatusError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HostNotFound(msg) => { write!(f, "HostNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_latest_commit.rs b/crates/weaver-api/src/com_atproto/sync/get_latest_commit.rs index ac346e5..11681e2 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_latest_commit.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_latest_commit.rs @@ -153,8 +153,8 @@ pub enum GetLatestCommitError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for GetLatestCommitError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetLatestCommitError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_record.rs b/crates/weaver-api/src/com_atproto/sync/get_record.rs index b1d39e1..33c2825 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_record.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_record.rs @@ -36,51 +36,51 @@ pub mod get_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; - type Collection; type Rkey; + type Collection; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; - type Collection = Unset; type Rkey = Unset; + type Collection = Unset; + type Did = Unset; } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; + ///State transition - sets the `rkey` field to Set + pub struct SetRkey(PhantomData S>); + impl sealed::Sealed for SetRkey {} + impl State for SetRkey { + type Rkey = Set; type Collection = S::Collection; - type Rkey = S::Rkey; + type Did = S::Did; } ///State transition - sets the `collection` field to Set pub struct SetCollection(PhantomData S>); impl sealed::Sealed for SetCollection {} impl State for SetCollection { - type Did = S::Did; - type Collection = Set; type Rkey = S::Rkey; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey(PhantomData S>); - impl sealed::Sealed for SetRkey {} - impl State for SetRkey { + type Collection = Set; type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Rkey = S::Rkey; type Collection = S::Collection; - type Rkey = Set; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `rkey` field pub struct rkey(()); + ///Marker type for the `collection` field + pub struct collection(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -181,9 +181,9 @@ where impl<'a, S> GetRecordBuilder<'a, S> where S: get_record_state::State, - S::Did: get_record_state::IsSet, - S::Collection: get_record_state::IsSet, S::Rkey: get_record_state::IsSet, + S::Collection: get_record_state::IsSet, + S::Did: get_record_state::IsSet, { /// Build the final struct pub fn build(self) -> GetRecord<'a> { @@ -236,8 +236,8 @@ pub enum GetRecordError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for GetRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RecordNotFound(msg) => { write!(f, "RecordNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_repo.rs b/crates/weaver-api/src/com_atproto/sync/get_repo.rs index c8343aa..1718dd8 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_repo.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_repo.rs @@ -173,8 +173,8 @@ pub enum GetRepoError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for GetRepoError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRepoError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/get_repo_status.rs b/crates/weaver-api/src/com_atproto/sync/get_repo_status.rs index ecec6ff..6eeac2b 100644 --- a/crates/weaver-api/src/com_atproto/sync/get_repo_status.rs +++ b/crates/weaver-api/src/com_atproto/sync/get_repo_status.rs @@ -132,7 +132,122 @@ pub struct GetRepoStatusOutput<'a> { /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GetRepoStatusOutputStatus<'a> { + Takendown, + Suspended, + Deleted, + Deactivated, + Desynchronized, + Throttled, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> GetRepoStatusOutputStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deleted => "deleted", + Self::Deactivated => "deactivated", + Self::Desynchronized => "desynchronized", + Self::Throttled => "throttled", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for GetRepoStatusOutputStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for GetRepoStatusOutputStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for GetRepoStatusOutputStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for GetRepoStatusOutputStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for GetRepoStatusOutputStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for GetRepoStatusOutputStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for GetRepoStatusOutputStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for GetRepoStatusOutputStatus<'_> { + type Output = GetRepoStatusOutputStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + GetRepoStatusOutputStatus::Takendown => GetRepoStatusOutputStatus::Takendown, + GetRepoStatusOutputStatus::Suspended => GetRepoStatusOutputStatus::Suspended, + GetRepoStatusOutputStatus::Deleted => GetRepoStatusOutputStatus::Deleted, + GetRepoStatusOutputStatus::Deactivated => { + GetRepoStatusOutputStatus::Deactivated + } + GetRepoStatusOutputStatus::Desynchronized => { + GetRepoStatusOutputStatus::Desynchronized + } + GetRepoStatusOutputStatus::Throttled => GetRepoStatusOutputStatus::Throttled, + GetRepoStatusOutputStatus::Other(v) => { + GetRepoStatusOutputStatus::Other(v.into_static()) + } + } + } } #[jacquard_derive::open_union] @@ -154,8 +269,8 @@ pub enum GetRepoStatusError<'a> { RepoNotFound(std::option::Option>), } -impl std::fmt::Display for GetRepoStatusError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRepoStatusError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/list_blobs.rs b/crates/weaver-api/src/com_atproto/sync/list_blobs.rs index 523b026..dce1a41 100644 --- a/crates/weaver-api/src/com_atproto/sync/list_blobs.rs +++ b/crates/weaver-api/src/com_atproto/sync/list_blobs.rs @@ -217,8 +217,8 @@ pub enum ListBlobsError<'a> { RepoDeactivated(std::option::Option>), } -impl std::fmt::Display for ListBlobsError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ListBlobsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; diff --git a/crates/weaver-api/src/com_atproto/sync/list_hosts.rs b/crates/weaver-api/src/com_atproto/sync/list_hosts.rs index f26bb5b..a7384ff 100644 --- a/crates/weaver-api/src/com_atproto/sync/list_hosts.rs +++ b/crates/weaver-api/src/com_atproto/sync/list_hosts.rs @@ -40,7 +40,7 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("host"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -53,7 +53,7 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accountCount", @@ -120,7 +120,7 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> ::jacquard_lexicon::lexicon::Lexi required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -172,7 +172,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Host<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/com_atproto/sync/list_repos.rs b/crates/weaver-api/src/com_atproto/sync/list_repos.rs index 49854a8..fa5ad81 100644 --- a/crates/weaver-api/src/com_atproto/sync/list_repos.rs +++ b/crates/weaver-api/src/com_atproto/sync/list_repos.rs @@ -181,7 +181,7 @@ pub struct Repo<'a> { /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, } pub mod repo_state { @@ -195,50 +195,50 @@ pub mod repo_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; - type Rev; type Head; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; - type Rev = Unset; type Head = Unset; + type Rev = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Did = Set; - type Rev = S::Rev; - type Head = S::Head; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { - type Did = S::Did; - type Rev = Set; type Head = S::Head; + type Rev = S::Rev; } ///State transition - sets the `head` field to Set pub struct SetHead(PhantomData S>); impl sealed::Sealed for SetHead {} impl State for SetHead { type Did = S::Did; - type Rev = S::Rev; type Head = Set; + type Rev = S::Rev; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { + type Did = S::Did; + type Head = S::Head; + type Rev = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `rev` field - pub struct rev(()); ///Marker type for the `head` field pub struct head(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -250,7 +250,7 @@ pub struct RepoBuilder<'a, S: repo_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -345,15 +345,12 @@ where impl<'a, S: repo_state::State> RepoBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } @@ -363,8 +360,8 @@ impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, S::Did: repo_state::IsSet, - S::Rev: repo_state::IsSet, S::Head: repo_state::IsSet, + S::Rev: repo_state::IsSet, { /// Build the final struct pub fn build(self) -> Repo<'a> { @@ -396,6 +393,115 @@ where } } +/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RepoStatus<'a> { + Takendown, + Suspended, + Deleted, + Deactivated, + Desynchronized, + Throttled, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RepoStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deleted => "deleted", + Self::Deactivated => "deactivated", + Self::Desynchronized => "desynchronized", + Self::Throttled => "throttled", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RepoStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RepoStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RepoStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RepoStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RepoStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RepoStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RepoStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RepoStatus<'_> { + type Output = RepoStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + RepoStatus::Takendown => RepoStatus::Takendown, + RepoStatus::Suspended => RepoStatus::Suspended, + RepoStatus::Deleted => RepoStatus::Deleted, + RepoStatus::Deactivated => RepoStatus::Deactivated, + RepoStatus::Desynchronized => RepoStatus::Desynchronized, + RepoStatus::Throttled => RepoStatus::Throttled, + RepoStatus::Other(v) => RepoStatus::Other(v.into_static()), + } + } +} + fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -405,7 +511,7 @@ fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -416,7 +522,7 @@ fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::Lexi required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -465,7 +571,7 @@ fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("active"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -569,7 +675,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Repo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/sync/list_repos_by_collection.rs b/crates/weaver-api/src/com_atproto/sync/list_repos_by_collection.rs index 4a0c9bc..316611f 100644 --- a/crates/weaver-api/src/com_atproto/sync/list_repos_by_collection.rs +++ b/crates/weaver-api/src/com_atproto/sync/list_repos_by_collection.rs @@ -333,7 +333,7 @@ fn lexicon_doc_com_atproto_sync_listReposByCollection() -> ::jacquard_lexicon::l revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -348,7 +348,7 @@ fn lexicon_doc_com_atproto_sync_listReposByCollection() -> ::jacquard_lexicon::l ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collection", @@ -412,7 +412,7 @@ fn lexicon_doc_com_atproto_sync_listReposByCollection() -> ::jacquard_lexicon::l nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -451,7 +451,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Repo<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/sync/request_crawl.rs b/crates/weaver-api/src/com_atproto/sync/request_crawl.rs index 080a41f..f476b90 100644 --- a/crates/weaver-api/src/com_atproto/sync/request_crawl.rs +++ b/crates/weaver-api/src/com_atproto/sync/request_crawl.rs @@ -42,8 +42,8 @@ pub enum RequestCrawlError<'a> { HostBanned(std::option::Option>), } -impl std::fmt::Display for RequestCrawlError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for RequestCrawlError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::HostBanned(msg) => { write!(f, "HostBanned")?; diff --git a/crates/weaver-api/src/com_atproto/sync/subscribe_repos.rs b/crates/weaver-api/src/com_atproto/sync/subscribe_repos.rs index 4982b33..d2b496d 100644 --- a/crates/weaver-api/src/com_atproto/sync/subscribe_repos.rs +++ b/crates/weaver-api/src/com_atproto/sync/subscribe_repos.rs @@ -26,7 +26,7 @@ pub struct Account<'a> { /// If active=false, this optional field indicates a reason for why the account is not active. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, pub time: jacquard_common::types::string::Datetime, } @@ -41,66 +41,66 @@ pub mod account_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; + type Active; type Seq; type Time; - type Active; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; + type Active = Unset; type Seq = Unset; type Time = Unset; - type Active = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Did = Set; + type Active = S::Active; + type Seq = S::Seq; + type Time = S::Time; + } + ///State transition - sets the `active` field to Set + pub struct SetActive(PhantomData S>); + impl sealed::Sealed for SetActive {} + impl State for SetActive { + type Did = S::Did; + type Active = Set; type Seq = S::Seq; type Time = S::Time; - type Active = S::Active; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData S>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { type Did = S::Did; + type Active = S::Active; type Seq = Set; type Time = S::Time; - type Active = S::Active; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData S>); impl sealed::Sealed for SetTime {} impl State for SetTime { type Did = S::Did; - type Seq = S::Seq; - type Time = Set; type Active = S::Active; - } - ///State transition - sets the `active` field to Set - pub struct SetActive(PhantomData S>); - impl sealed::Sealed for SetActive {} - impl State for SetActive { - type Did = S::Did; type Seq = S::Seq; - type Time = S::Time; - type Active = Set; + type Time = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `active` field + pub struct active(()); ///Marker type for the `seq` field pub struct seq(()); ///Marker type for the `time` field pub struct time(()); - ///Marker type for the `active` field - pub struct active(()); } } @@ -111,7 +111,7 @@ pub struct AccountBuilder<'a, S: account_state::State> { ::core::option::Option, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -194,15 +194,12 @@ where impl<'a, S: account_state::State> AccountBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.3 = value; self } @@ -231,9 +228,9 @@ impl<'a, S> AccountBuilder<'a, S> where S: account_state::State, S::Did: account_state::IsSet, + S::Active: account_state::IsSet, S::Seq: account_state::IsSet, S::Time: account_state::IsSet, - S::Active: account_state::IsSet, { /// Build the final struct pub fn build(self) -> Account<'a> { @@ -265,6 +262,115 @@ where } } +/// If active=false, this optional field indicates a reason for why the account is not active. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AccountStatus<'a> { + Takendown, + Suspended, + Deleted, + Deactivated, + Desynchronized, + Throttled, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AccountStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deleted => "deleted", + Self::Deactivated => "deactivated", + Self::Desynchronized => "desynchronized", + Self::Throttled => "throttled", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AccountStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AccountStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "desynchronized" => Self::Desynchronized, + "throttled" => Self::Throttled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AccountStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AccountStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AccountStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AccountStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AccountStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AccountStatus<'_> { + type Output = AccountStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AccountStatus::Takendown => AccountStatus::Takendown, + AccountStatus::Suspended => AccountStatus::Suspended, + AccountStatus::Deleted => AccountStatus::Deleted, + AccountStatus::Deactivated => AccountStatus::Deactivated, + AccountStatus::Desynchronized => AccountStatus::Desynchronized, + AccountStatus::Throttled => AccountStatus::Throttled, + AccountStatus::Other(v) => AccountStatus::Other(v.into_static()), + } + } +} + fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -274,7 +380,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("account"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -294,7 +400,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("active"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -397,7 +503,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobs"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -574,7 +680,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -655,7 +761,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("message"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -700,7 +806,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -739,7 +845,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -806,7 +912,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocks"), ::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes { @@ -908,7 +1014,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Account<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -967,205 +1073,205 @@ pub mod commit_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; - type Blobs; type Seq; - type Repo; + type Blobs; + type Blocks; + type Rev; type Commit; type Ops; - type TooBig; - type Blocks; - type Rebase; + type Repo; type Time; + type Rebase; + type TooBig; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; - type Blobs = Unset; type Seq = Unset; - type Repo = Unset; + type Blobs = Unset; + type Blocks = Unset; + type Rev = Unset; type Commit = Unset; type Ops = Unset; - type TooBig = Unset; - type Blocks = Unset; - type Rebase = Unset; + type Repo = Unset; type Time = Unset; + type Rebase = Unset; + type TooBig = Unset; } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { - type Rev = Set; + ///State transition - sets the `seq` field to Set + pub struct SetSeq(PhantomData S>); + impl sealed::Sealed for SetSeq {} + impl State for SetSeq { + type Seq = Set; type Blobs = S::Blobs; - type Seq = S::Seq; - type Repo = S::Repo; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } ///State transition - sets the `blobs` field to Set pub struct SetBlobs(PhantomData S>); impl sealed::Sealed for SetBlobs {} impl State for SetBlobs { - type Rev = S::Rev; - type Blobs = Set; type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = Set; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } - ///State transition - sets the `seq` field to Set - pub struct SetSeq(PhantomData S>); - impl sealed::Sealed for SetSeq {} - impl State for SetSeq { - type Rev = S::Rev; + ///State transition - sets the `blocks` field to Set + pub struct SetBlocks(PhantomData S>); + impl sealed::Sealed for SetBlocks {} + impl State for SetBlocks { + type Seq = S::Seq; type Blobs = S::Blobs; - type Seq = Set; - type Repo = S::Repo; + type Blocks = Set; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } - ///State transition - sets the `repo` field to Set - pub struct SetRepo(PhantomData S>); - impl sealed::Sealed for SetRepo {} - impl State for SetRepo { - type Rev = S::Rev; - type Blobs = S::Blobs; + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { type Seq = S::Seq; - type Repo = Set; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = Set; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } ///State transition - sets the `commit` field to Set pub struct SetCommit(PhantomData S>); impl sealed::Sealed for SetCommit {} impl State for SetCommit { - type Rev = S::Rev; - type Blobs = S::Blobs; type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = Set; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } ///State transition - sets the `ops` field to Set pub struct SetOps(PhantomData S>); impl sealed::Sealed for SetOps {} impl State for SetOps { - type Rev = S::Rev; - type Blobs = S::Blobs; type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = Set; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = S::Repo; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } - ///State transition - sets the `too_big` field to Set - pub struct SetTooBig(PhantomData S>); - impl sealed::Sealed for SetTooBig {} - impl State for SetTooBig { - type Rev = S::Rev; - type Blobs = S::Blobs; + ///State transition - sets the `repo` field to Set + pub struct SetRepo(PhantomData S>); + impl sealed::Sealed for SetRepo {} + impl State for SetRepo { type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = Set; - type Blocks = S::Blocks; - type Rebase = S::Rebase; + type Repo = Set; type Time = S::Time; + type Rebase = S::Rebase; + type TooBig = S::TooBig; } - ///State transition - sets the `blocks` field to Set - pub struct SetBlocks(PhantomData S>); - impl sealed::Sealed for SetBlocks {} - impl State for SetBlocks { - type Rev = S::Rev; - type Blobs = S::Blobs; + ///State transition - sets the `time` field to Set + pub struct SetTime(PhantomData S>); + impl sealed::Sealed for SetTime {} + impl State for SetTime { type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = Set; + type Repo = S::Repo; + type Time = Set; type Rebase = S::Rebase; - type Time = S::Time; + type TooBig = S::TooBig; } ///State transition - sets the `rebase` field to Set pub struct SetRebase(PhantomData S>); impl sealed::Sealed for SetRebase {} impl State for SetRebase { - type Rev = S::Rev; - type Blobs = S::Blobs; type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; - type Rebase = Set; + type Repo = S::Repo; type Time = S::Time; + type Rebase = Set; + type TooBig = S::TooBig; } - ///State transition - sets the `time` field to Set - pub struct SetTime(PhantomData S>); - impl sealed::Sealed for SetTime {} - impl State for SetTime { - type Rev = S::Rev; - type Blobs = S::Blobs; + ///State transition - sets the `too_big` field to Set + pub struct SetTooBig(PhantomData S>); + impl sealed::Sealed for SetTooBig {} + impl State for SetTooBig { type Seq = S::Seq; - type Repo = S::Repo; + type Blobs = S::Blobs; + type Blocks = S::Blocks; + type Rev = S::Rev; type Commit = S::Commit; type Ops = S::Ops; - type TooBig = S::TooBig; - type Blocks = S::Blocks; + type Repo = S::Repo; + type Time = S::Time; type Rebase = S::Rebase; - type Time = Set; + type TooBig = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); - ///Marker type for the `blobs` field - pub struct blobs(()); ///Marker type for the `seq` field pub struct seq(()); - ///Marker type for the `repo` field - pub struct repo(()); + ///Marker type for the `blobs` field + pub struct blobs(()); + ///Marker type for the `blocks` field + pub struct blocks(()); + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `commit` field pub struct commit(()); ///Marker type for the `ops` field pub struct ops(()); - ///Marker type for the `too_big` field - pub struct too_big(()); - ///Marker type for the `blocks` field - pub struct blocks(()); - ///Marker type for the `rebase` field - pub struct rebase(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `time` field pub struct time(()); + ///Marker type for the `rebase` field + pub struct rebase(()); + ///Marker type for the `too_big` field + pub struct too_big(()); } } @@ -1453,16 +1559,16 @@ where impl<'a, S> CommitBuilder<'a, S> where S: commit_state::State, - S::Rev: commit_state::IsSet, - S::Blobs: commit_state::IsSet, S::Seq: commit_state::IsSet, - S::Repo: commit_state::IsSet, + S::Blobs: commit_state::IsSet, + S::Blocks: commit_state::IsSet, + S::Rev: commit_state::IsSet, S::Commit: commit_state::IsSet, S::Ops: commit_state::IsSet, - S::TooBig: commit_state::IsSet, - S::Blocks: commit_state::IsSet, - S::Rebase: commit_state::IsSet, + S::Repo: commit_state::IsSet, S::Time: commit_state::IsSet, + S::Rebase: commit_state::IsSet, + S::TooBig: commit_state::IsSet, { /// Build the final struct pub fn build(self) -> Commit<'a> { @@ -1520,7 +1626,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Commit<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.ops; #[allow(unused_comparisons)] @@ -1571,51 +1677,51 @@ pub mod identity_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Time; type Did; type Seq; - type Time; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Time = Unset; type Did = Unset; type Seq = Unset; - type Time = Unset; + } + ///State transition - sets the `time` field to Set + pub struct SetTime(PhantomData S>); + impl sealed::Sealed for SetTime {} + impl State for SetTime { + type Time = Set; + type Did = S::Did; + type Seq = S::Seq; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { + type Time = S::Time; type Did = Set; type Seq = S::Seq; - type Time = S::Time; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData S>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { - type Did = S::Did; - type Seq = Set; type Time = S::Time; - } - ///State transition - sets the `time` field to Set - pub struct SetTime(PhantomData S>); - impl sealed::Sealed for SetTime {} - impl State for SetTime { type Did = S::Did; - type Seq = S::Seq; - type Time = Set; + type Seq = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `time` field + pub struct time(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `seq` field pub struct seq(()); - ///Marker type for the `time` field - pub struct time(()); } } @@ -1728,9 +1834,9 @@ where impl<'a, S> IdentityBuilder<'a, S> where S: identity_state::State, + S::Time: identity_state::IsSet, S::Did: identity_state::IsSet, S::Seq: identity_state::IsSet, - S::Time: identity_state::IsSet, { /// Build the final struct pub fn build(self) -> Identity<'a> { @@ -1772,7 +1878,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Identity<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1794,7 +1900,90 @@ pub struct Info<'a> { #[serde(borrow)] pub message: std::option::Option>, #[serde(borrow)] - pub name: jacquard_common::CowStr<'a>, + pub name: InfoName<'a>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum InfoName<'a> { + OutdatedCursor, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> InfoName<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::OutdatedCursor => "OutdatedCursor", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for InfoName<'a> { + fn from(s: &'a str) -> Self { + match s { + "OutdatedCursor" => Self::OutdatedCursor, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for InfoName<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "OutdatedCursor" => Self::OutdatedCursor, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for InfoName<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for InfoName<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for InfoName<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for InfoName<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for InfoName<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for InfoName<'_> { + type Output = InfoName<'static>; + fn into_static(self) -> Self::Output { + match self { + InfoName::OutdatedCursor => InfoName::OutdatedCursor, + InfoName::Other(v) => InfoName::Other(v.into_static()), + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Info<'a> { @@ -1809,7 +1998,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Info<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1981,8 +2170,8 @@ pub enum SubscribeReposError<'a> { ConsumerTooSlow(std::option::Option>), } -impl std::fmt::Display for SubscribeReposError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for SubscribeReposError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::FutureCursor(msg) => { write!(f, "FutureCursor")?; @@ -2046,7 +2235,7 @@ impl jacquard_common::xrpc::SubscriptionEndpoint for SubscribeReposEndpoint { #[serde(rename_all = "camelCase")] pub struct RepoOp<'a> { #[serde(borrow)] - pub action: jacquard_common::CowStr<'a>, + pub action: RepoOpAction<'a>, /// For creates and updates, the new record CID. For deletions, null. #[serde(borrow)] pub cid: std::option::Option>, @@ -2106,7 +2295,7 @@ pub mod repo_op_state { pub struct RepoOpBuilder<'a, S: repo_op_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, @@ -2140,7 +2329,7 @@ where /// Set the `action` field (required) pub fn action( mut self, - value: impl Into>, + value: impl Into>, ) -> RepoOpBuilder<'a, repo_op_state::SetAction> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); RepoOpBuilder { @@ -2242,6 +2431,99 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RepoOpAction<'a> { + Create, + Update, + Delete, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RepoOpAction<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Create => "create", + Self::Update => "update", + Self::Delete => "delete", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RepoOpAction<'a> { + fn from(s: &'a str) -> Self { + match s { + "create" => Self::Create, + "update" => Self::Update, + "delete" => Self::Delete, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RepoOpAction<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "create" => Self::Create, + "update" => Self::Update, + "delete" => Self::Delete, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RepoOpAction<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RepoOpAction<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RepoOpAction<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RepoOpAction<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RepoOpAction<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RepoOpAction<'_> { + type Output = RepoOpAction<'static>; + fn into_static(self) -> Self::Output { + match self { + RepoOpAction::Create => RepoOpAction::Create, + RepoOpAction::Update => RepoOpAction::Update, + RepoOpAction::Delete => RepoOpAction::Delete, + RepoOpAction::Other(v) => RepoOpAction::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoOp<'a> { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" @@ -2254,7 +2536,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoOp<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2297,85 +2579,85 @@ pub mod sync_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; - type Time; type Did; + type Time; type Seq; type Blocks; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; - type Time = Unset; type Did = Unset; + type Time = Unset; type Seq = Unset; type Blocks = Unset; + type Rev = Unset; } - ///State transition - sets the `rev` field to Set - pub struct SetRev(PhantomData S>); - impl sealed::Sealed for SetRev {} - impl State for SetRev { - type Rev = Set; + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Did = Set; type Time = S::Time; - type Did = S::Did; type Seq = S::Seq; type Blocks = S::Blocks; + type Rev = S::Rev; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData S>); impl sealed::Sealed for SetTime {} impl State for SetTime { - type Rev = S::Rev; - type Time = Set; type Did = S::Did; + type Time = Set; type Seq = S::Seq; type Blocks = S::Blocks; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { type Rev = S::Rev; - type Time = S::Time; - type Did = Set; - type Seq = S::Seq; - type Blocks = S::Blocks; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData S>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { - type Rev = S::Rev; - type Time = S::Time; type Did = S::Did; + type Time = S::Time; type Seq = Set; type Blocks = S::Blocks; + type Rev = S::Rev; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks(PhantomData S>); impl sealed::Sealed for SetBlocks {} impl State for SetBlocks { - type Rev = S::Rev; - type Time = S::Time; type Did = S::Did; + type Time = S::Time; type Seq = S::Seq; type Blocks = Set; + type Rev = S::Rev; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev(PhantomData S>); + impl sealed::Sealed for SetRev {} + impl State for SetRev { + type Did = S::Did; + type Time = S::Time; + type Seq = S::Seq; + type Blocks = S::Blocks; + type Rev = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); - ///Marker type for the `time` field - pub struct time(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `time` field + pub struct time(()); ///Marker type for the `seq` field pub struct seq(()); ///Marker type for the `blocks` field pub struct blocks(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -2508,11 +2790,11 @@ where impl<'a, S> SyncBuilder<'a, S> where S: sync_state::State, - S::Rev: sync_state::IsSet, - S::Time: sync_state::IsSet, S::Did: sync_state::IsSet, + S::Time: sync_state::IsSet, S::Seq: sync_state::IsSet, S::Blocks: sync_state::IsSet, + S::Rev: sync_state::IsSet, { /// Build the final struct pub fn build(self) -> Sync<'a> { @@ -2556,7 +2838,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Sync<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/temp/check_handle_availability.rs b/crates/weaver-api/src/com_atproto/temp/check_handle_availability.rs index 3366a1f..abe0181 100644 --- a/crates/weaver-api/src/com_atproto/temp/check_handle_availability.rs +++ b/crates/weaver-api/src/com_atproto/temp/check_handle_availability.rs @@ -232,8 +232,8 @@ pub enum CheckHandleAvailabilityError<'a> { InvalidEmail(std::option::Option>), } -impl std::fmt::Display for CheckHandleAvailabilityError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CheckHandleAvailabilityError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidEmail(msg) => { write!(f, "InvalidEmail")?; @@ -298,7 +298,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -313,7 +313,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon: ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "birthDate", @@ -397,7 +397,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -418,7 +418,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "suggestions", @@ -454,7 +454,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("handle"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -512,7 +512,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResultAvailable<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -658,7 +658,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResultUnavailable<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -834,7 +834,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Suggestion<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_atproto/temp/dereference_scope.rs b/crates/weaver-api/src/com_atproto/temp/dereference_scope.rs index 1f7b3da..e45cdba 100644 --- a/crates/weaver-api/src/com_atproto/temp/dereference_scope.rs +++ b/crates/weaver-api/src/com_atproto/temp/dereference_scope.rs @@ -147,8 +147,8 @@ pub enum DereferenceScopeError<'a> { InvalidScopeReference(std::option::Option>), } -impl std::fmt::Display for DereferenceScopeError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DereferenceScopeError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidScopeReference(msg) => { write!(f, "InvalidScopeReference")?; diff --git a/crates/weaver-api/src/com_deckbelcher.rs b/crates/weaver-api/src/com_deckbelcher.rs new file mode 100644 index 0000000..39c01e2 --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher.rs @@ -0,0 +1,9 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod actor; +pub mod deck; +pub mod richtext; +pub mod social; \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/actor.rs b/crates/weaver-api/src/com_deckbelcher/actor.rs new file mode 100644 index 0000000..534c968 --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/actor.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod profile; \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/actor/profile.rs b/crates/weaver-api/src/com_deckbelcher/actor/profile.rs new file mode 100644 index 0000000..c8854c9 --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/actor/profile.rs @@ -0,0 +1,545 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: com.deckbelcher.actor.profile +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A DeckBelcher user profile. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Profile<'a> { + /// Timestamp when the profile was created. + pub created_at: jacquard_common::types::string::Datetime, + /// Free-form profile description. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option>, + /// Annotations of text in the profile description (mentions, URLs, hashtags, etc). + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description_facets: std::option::Option< + Vec>, + >, + /// User's display name. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub display_name: std::option::Option>, + /// Free-form pronouns text. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub pronouns: std::option::Option>, +} + +pub mod profile_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type CreatedAt = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ProfileBuilder<'a, S: profile_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option, + ::core::option::Option>, + ::core::option::Option>>, + ::core::option::Option>, + ::core::option::Option>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Profile<'a> { + /// Create a new builder for this type + pub fn new() -> ProfileBuilder<'a, profile_state::Empty> { + ProfileBuilder::new() + } +} + +impl<'a> ProfileBuilder<'a, profile_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, + S::CreatedAt: profile_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into, + ) -> ProfileBuilder<'a, profile_state::SetCreatedAt> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `descriptionFacets` field (optional) + pub fn description_facets( + mut self, + value: impl Into>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `descriptionFacets` field to an Option value (optional) + pub fn maybe_description_facets( + mut self, + value: Option>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `displayName` field (optional) + pub fn display_name( + mut self, + value: impl Into>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `displayName` field to an Option value (optional) + pub fn maybe_display_name( + mut self, + value: Option>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `pronouns` field (optional) + pub fn pronouns( + mut self, + value: impl Into>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `pronouns` field to an Option value (optional) + pub fn maybe_pronouns(mut self, value: Option>) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, + S::CreatedAt: profile_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Profile<'a> { + Profile { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + description_facets: self.__unsafe_private_named.2, + display_name: self.__unsafe_private_named.3, + pronouns: self.__unsafe_private_named.4, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Profile<'a> { + Profile { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + description_facets: self.__unsafe_private_named.2, + display_name: self.__unsafe_private_named.3, + pronouns: self.__unsafe_private_named.4, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Profile<'a> { + pub fn uri( + uri: impl Into>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ProfileRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ProfileGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Profile<'a>, +} + +impl From> for Profile<'_> { + fn from(output: ProfileGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Profile<'_> { + const NSID: &'static str = "com.deckbelcher.actor.profile"; + type Record = ProfileRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ProfileRecord; +impl jacquard_common::xrpc::XrpcResp for ProfileRecord { + const NSID: &'static str = "com.deckbelcher.actor.profile"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ProfileGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ProfileRecord { + const NSID: &'static str = "com.deckbelcher.actor.profile"; + type Record = ProfileRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.actor.profile" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_actor_profile() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 2560usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 2560usize, + actual: ::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 256usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.display_name { + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 640usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "display_name", + ), + max: 640usize, + actual: ::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.display_name { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "display_name", + ), + max: 64usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.pronouns { + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 200usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "pronouns", + ), + max: 200usize, + actual: ::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.pronouns { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 20usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "pronouns", + ), + max: 20usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_com_deckbelcher_actor_profile() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("com.deckbelcher.actor.profile"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A DeckBelcher user profile.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("literal:self")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the profile was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Free-form profile description.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(2560usize), + min_graphemes: None, + max_graphemes: Some(256usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "descriptionFacets", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Annotations of text in the profile description (mentions, URLs, hashtags, etc).", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.deckbelcher.richtext.facet", + ), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "displayName", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "User's display name.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(640usize), + min_graphemes: None, + max_graphemes: Some(64usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "pronouns", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Free-form pronouns text.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(200usize), + min_graphemes: None, + max_graphemes: Some(20usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/deck.rs b/crates/weaver-api/src/com_deckbelcher/deck.rs new file mode 100644 index 0000000..b91fb2d --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/deck.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod list; \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/deck/list.rs b/crates/weaver-api/src/com_deckbelcher/deck/list.rs new file mode 100644 index 0000000..0801a8e --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/deck/list.rs @@ -0,0 +1,1124 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: com.deckbelcher.deck.list +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A card entry in a decklist. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Card<'a> { + /// Number of copies in the deck. + pub quantity: i64, + /// Scryfall UUID for the specific printing. + #[serde(borrow)] + pub scryfall_id: jacquard_common::CowStr<'a>, + /// Which section of the deck this card belongs to. Extensible to support format-specific sections. + #[serde(borrow)] + pub section: CardSection<'a>, + /// User annotations for this card in this deck (e.g., "removal", "wincon", "ramp"). + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option>>, +} + +pub mod card_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Section; + type ScryfallId; + type Quantity; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Section = Unset; + type ScryfallId = Unset; + type Quantity = Unset; + } + ///State transition - sets the `section` field to Set + pub struct SetSection(PhantomData S>); + impl sealed::Sealed for SetSection {} + impl State for SetSection { + type Section = Set; + type ScryfallId = S::ScryfallId; + type Quantity = S::Quantity; + } + ///State transition - sets the `scryfall_id` field to Set + pub struct SetScryfallId(PhantomData S>); + impl sealed::Sealed for SetScryfallId {} + impl State for SetScryfallId { + type Section = S::Section; + type ScryfallId = Set; + type Quantity = S::Quantity; + } + ///State transition - sets the `quantity` field to Set + pub struct SetQuantity(PhantomData S>); + impl sealed::Sealed for SetQuantity {} + impl State for SetQuantity { + type Section = S::Section; + type ScryfallId = S::ScryfallId; + type Quantity = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `section` field + pub struct section(()); + ///Marker type for the `scryfall_id` field + pub struct scryfall_id(()); + ///Marker type for the `quantity` field + pub struct quantity(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CardBuilder<'a, S: card_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option, + ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Card<'a> { + /// Create a new builder for this type + pub fn new() -> CardBuilder<'a, card_state::Empty> { + CardBuilder::new() + } +} + +impl<'a> CardBuilder<'a, card_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CardBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CardBuilder<'a, S> +where + S: card_state::State, + S::Quantity: card_state::IsUnset, +{ + /// Set the `quantity` field (required) + pub fn quantity( + mut self, + value: impl Into, + ) -> CardBuilder<'a, card_state::SetQuantity> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CardBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CardBuilder<'a, S> +where + S: card_state::State, + S::ScryfallId: card_state::IsUnset, +{ + /// Set the `scryfallId` field (required) + pub fn scryfall_id( + mut self, + value: impl Into>, + ) -> CardBuilder<'a, card_state::SetScryfallId> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CardBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CardBuilder<'a, S> +where + S: card_state::State, + S::Section: card_state::IsUnset, +{ + /// Set the `section` field (required) + pub fn section( + mut self, + value: impl Into>, + ) -> CardBuilder<'a, card_state::SetSection> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + CardBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: card_state::State> CardBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> CardBuilder<'a, S> +where + S: card_state::State, + S::Section: card_state::IsSet, + S::ScryfallId: card_state::IsSet, + S::Quantity: card_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Card<'a> { + Card { + quantity: self.__unsafe_private_named.0.unwrap(), + scryfall_id: self.__unsafe_private_named.1.unwrap(), + section: self.__unsafe_private_named.2.unwrap(), + tags: self.__unsafe_private_named.3, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Card<'a> { + Card { + quantity: self.__unsafe_private_named.0.unwrap(), + scryfall_id: self.__unsafe_private_named.1.unwrap(), + section: self.__unsafe_private_named.2.unwrap(), + tags: self.__unsafe_private_named.3, + extra_data: Some(extra_data), + } + } +} + +/// Which section of the deck this card belongs to. Extensible to support format-specific sections. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum CardSection<'a> { + Mainboard, + Sideboard, + Maybeboard, + Commander, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> CardSection<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Mainboard => "mainboard", + Self::Sideboard => "sideboard", + Self::Maybeboard => "maybeboard", + Self::Commander => "commander", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for CardSection<'a> { + fn from(s: &'a str) -> Self { + match s { + "mainboard" => Self::Mainboard, + "sideboard" => Self::Sideboard, + "maybeboard" => Self::Maybeboard, + "commander" => Self::Commander, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for CardSection<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "mainboard" => Self::Mainboard, + "sideboard" => Self::Sideboard, + "maybeboard" => Self::Maybeboard, + "commander" => Self::Commander, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for CardSection<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for CardSection<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for CardSection<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for CardSection<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for CardSection<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for CardSection<'_> { + type Output = CardSection<'static>; + fn into_static(self) -> Self::Output { + match self { + CardSection::Mainboard => CardSection::Mainboard, + CardSection::Sideboard => CardSection::Sideboard, + CardSection::Maybeboard => CardSection::Maybeboard, + CardSection::Commander => CardSection::Commander, + CardSection::Other(v) => CardSection::Other(v.into_static()), + } + } +} + +fn lexicon_doc_com_deckbelcher_deck_list() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("com.deckbelcher.deck.list"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("card"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A card entry in a decklist.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("scryfallId"), + ::jacquard_common::smol_str::SmolStr::new_static("quantity"), + ::jacquard_common::smol_str::SmolStr::new_static("section") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("quantity"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(1i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "scryfallId", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Scryfall UUID for the specific printing.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("section"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Which section of the deck this card belongs to. Extensible to support format-specific sections.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "User annotations for this card in this deck (e.g., \"removal\", \"wincon\", \"ramp\").", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "A tag annotation for a card.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(640usize), + min_graphemes: None, + max_graphemes: Some(64usize), + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(128usize), + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A Magic: The Gathering decklist.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("cards"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cards"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Array of cards in the decklist.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#card"), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the decklist was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("format"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Format of the deck (e.g., \"commander\", \"cube\", \"pauper\").", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(320usize), + min_graphemes: None, + max_graphemes: Some(32usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Name of the decklist.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1280usize), + min_graphemes: None, + max_graphemes: Some(128usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("primer"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Deck primer with strategy, combos, and card choices.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(100000usize), + min_graphemes: None, + max_graphemes: Some(10000usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "primerFacets", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Annotations of text in the primer (mentions, URLs, hashtags, card references, etc).", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.deckbelcher.richtext.facet", + ), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "updatedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the decklist was last updated.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Card<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.deck.list" + } + fn def_name() -> &'static str { + "card" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_deck_list() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.quantity; + if *value < 1i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "quantity", + ), + min: 1i64, + actual: *value, + }); + } + } + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 128usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 128usize, + actual: value.len(), + }); + } + } + Ok(()) + } +} + +/// A Magic: The Gathering decklist. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct List<'a> { + /// Array of cards in the decklist. + #[serde(borrow)] + pub cards: Vec>, + /// Timestamp when the decklist was created. + pub created_at: jacquard_common::types::string::Datetime, + /// Format of the deck (e.g., "commander", "cube", "pauper"). + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub format: std::option::Option>, + /// Name of the decklist. + #[serde(borrow)] + pub name: jacquard_common::CowStr<'a>, + /// Deck primer with strategy, combos, and card choices. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub primer: std::option::Option>, + /// Annotations of text in the primer (mentions, URLs, hashtags, card references, etc). + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub primer_facets: std::option::Option< + Vec>, + >, + /// Timestamp when the decklist was last updated. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub updated_at: std::option::Option, +} + +pub mod list_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Cards; + type Name; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Cards = Unset; + type Name = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `cards` field to Set + pub struct SetCards(PhantomData S>); + impl sealed::Sealed for SetCards {} + impl State for SetCards { + type Cards = Set; + type Name = S::Name; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Cards = S::Cards; + type Name = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Cards = S::Cards; + type Name = S::Name; + type CreatedAt = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `cards` field + pub struct cards(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ListBuilder<'a, S: list_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option>>, + ::core::option::Option, + ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>>, + ::core::option::Option, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> List<'a> { + /// Create a new builder for this type + pub fn new() -> ListBuilder<'a, list_state::Empty> { + ListBuilder::new() + } +} + +impl<'a> ListBuilder<'a, list_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ListBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ListBuilder<'a, S> +where + S: list_state::State, + S::Cards: list_state::IsUnset, +{ + /// Set the `cards` field (required) + pub fn cards( + mut self, + value: impl Into>>, + ) -> ListBuilder<'a, list_state::SetCards> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ListBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ListBuilder<'a, S> +where + S: list_state::State, + S::CreatedAt: list_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into, + ) -> ListBuilder<'a, list_state::SetCreatedAt> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ListBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: list_state::State> ListBuilder<'a, S> { + /// Set the `format` field (optional) + pub fn format( + mut self, + value: impl Into>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `format` field to an Option value (optional) + pub fn maybe_format(mut self, value: Option>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> ListBuilder<'a, S> +where + S: list_state::State, + S::Name: list_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into>, + ) -> ListBuilder<'a, list_state::SetName> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + ListBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: list_state::State> ListBuilder<'a, S> { + /// Set the `primer` field (optional) + pub fn primer( + mut self, + value: impl Into>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `primer` field to an Option value (optional) + pub fn maybe_primer(mut self, value: Option>) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: list_state::State> ListBuilder<'a, S> { + /// Set the `primerFacets` field (optional) + pub fn primer_facets( + mut self, + value: impl Into>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `primerFacets` field to an Option value (optional) + pub fn maybe_primer_facets( + mut self, + value: Option>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: list_state::State> ListBuilder<'a, S> { + /// Set the `updatedAt` field (optional) + pub fn updated_at( + mut self, + value: impl Into>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `updatedAt` field to an Option value (optional) + pub fn maybe_updated_at( + mut self, + value: Option, + ) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S> ListBuilder<'a, S> +where + S: list_state::State, + S::Cards: list_state::IsSet, + S::Name: list_state::IsSet, + S::CreatedAt: list_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> List<'a> { + List { + cards: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + format: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3.unwrap(), + primer: self.__unsafe_private_named.4, + primer_facets: self.__unsafe_private_named.5, + updated_at: self.__unsafe_private_named.6, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> List<'a> { + List { + cards: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + format: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3.unwrap(), + primer: self.__unsafe_private_named.4, + primer_facets: self.__unsafe_private_named.5, + updated_at: self.__unsafe_private_named.6, + extra_data: Some(extra_data), + } + } +} + +impl<'a> List<'a> { + pub fn uri( + uri: impl Into>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ListRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ListGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: List<'a>, +} + +impl From> for List<'_> { + fn from(output: ListGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for List<'_> { + const NSID: &'static str = "com.deckbelcher.deck.list"; + type Record = ListRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ListRecord; +impl jacquard_common::xrpc::XrpcResp for ListRecord { + const NSID: &'static str = "com.deckbelcher.deck.list"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ListGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ListRecord { + const NSID: &'static str = "com.deckbelcher.deck.list"; + type Record = ListRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for List<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.deck.list" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_deck_list() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.format { + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 320usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "format", + ), + max: 320usize, + actual: ::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.format { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "format", + ), + max: 32usize, + actual: count, + }); + } + } + } + { + let value = &self.name; + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 1280usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 1280usize, + actual: ::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 128usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 128usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.primer { + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 100000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "primer", + ), + max: 100000usize, + actual: ::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.primer { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 10000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "primer", + ), + max: 10000usize, + actual: count, + }); + } + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/richtext.rs b/crates/weaver-api/src/com_deckbelcher/richtext.rs new file mode 100644 index 0000000..b7b3177 --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/richtext.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod facet; \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/richtext/facet.rs b/crates/weaver-api/src/com_deckbelcher/richtext/facet.rs new file mode 100644 index 0000000..0d5020f --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/richtext/facet.rs @@ -0,0 +1,962 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: com.deckbelcher.richtext.facet +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/** Specifies the sub-string range a facet feature applies to. +Start index is inclusive, end index is exclusive. +Indices are zero-indexed, counting bytes of the UTF-8 encoded text.*/ +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ByteSlice<'a> { + pub byte_end: i64, + pub byte_start: i64, +} + +pub mod byte_slice_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type ByteStart; + type ByteEnd; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type ByteStart = Unset; + type ByteEnd = Unset; + } + ///State transition - sets the `byte_start` field to Set + pub struct SetByteStart(PhantomData S>); + impl sealed::Sealed for SetByteStart {} + impl State for SetByteStart { + type ByteStart = Set; + type ByteEnd = S::ByteEnd; + } + ///State transition - sets the `byte_end` field to Set + pub struct SetByteEnd(PhantomData S>); + impl sealed::Sealed for SetByteEnd {} + impl State for SetByteEnd { + type ByteStart = S::ByteStart; + type ByteEnd = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `byte_start` field + pub struct byte_start(()); + ///Marker type for the `byte_end` field + pub struct byte_end(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ByteSliceBuilder<'a, S: byte_slice_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: (::core::option::Option, ::core::option::Option), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> ByteSlice<'a> { + /// Create a new builder for this type + pub fn new() -> ByteSliceBuilder<'a, byte_slice_state::Empty> { + ByteSliceBuilder::new() + } +} + +impl<'a> ByteSliceBuilder<'a, byte_slice_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ByteSliceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ByteSliceBuilder<'a, S> +where + S: byte_slice_state::State, + S::ByteEnd: byte_slice_state::IsUnset, +{ + /// Set the `byteEnd` field (required) + pub fn byte_end( + mut self, + value: impl Into, + ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteEnd> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ByteSliceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ByteSliceBuilder<'a, S> +where + S: byte_slice_state::State, + S::ByteStart: byte_slice_state::IsUnset, +{ + /// Set the `byteStart` field (required) + pub fn byte_start( + mut self, + value: impl Into, + ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteStart> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ByteSliceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ByteSliceBuilder<'a, S> +where + S: byte_slice_state::State, + S::ByteStart: byte_slice_state::IsSet, + S::ByteEnd: byte_slice_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> ByteSlice<'a> { + ByteSlice { + byte_end: self.__unsafe_private_named.0.unwrap(), + byte_start: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> ByteSlice<'a> { + ByteSlice { + byte_end: self.__unsafe_private_named.0.unwrap(), + byte_start: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_com_deckbelcher_richtext_facet() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("com.deckbelcher.richtext.facet"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("byteSlice"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Specifies the sub-string range a facet feature applies to.\nStart index is inclusive, end index is exclusive.\nIndices are zero-indexed, counting bytes of the UTF-8 encoded text.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("byteStart"), + ::jacquard_common::smol_str::SmolStr::new_static("byteEnd") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "byteStart", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("link"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Facet feature for a URL.\nThe text URL may have been simplified or truncated, but the facet reference should be a complete URL.", + ), + ), + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("uri")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Annotation of a sub-string within rich text.\nExtends Bluesky's facet system to support DeckBelcher-specific features.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("index"), + ::jacquard_common::smol_str::SmolStr::new_static("features") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("features"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: None, + items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: None, + refs: vec![ + ::jacquard_common::CowStr::new_static("#mention"), + ::jacquard_common::CowStr::new_static("#link"), + ::jacquard_common::CowStr::new_static("#tag") + ], + closed: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("index"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#byteSlice"), + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("mention"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Facet feature for mention of another account.\nThe text is usually a handle, including an `@` prefix, but the facet reference is a DID.", + ), + ), + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("did")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("did"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tag"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Facet feature for a hashtag.\nThe text usually includes a '#' prefix, but the facet reference should not.", + ), + ), + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("tag")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tag"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(640usize), + min_graphemes: None, + max_graphemes: Some(64usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.richtext.facet" + } + fn def_name() -> &'static str { + "byteSlice" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_richtext_facet() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.byte_end; + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "byte_end", + ), + min: 0i64, + actual: *value, + }); + } + } + { + let value = &self.byte_start; + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "byte_start", + ), + min: 0i64, + actual: *value, + }); + } + } + Ok(()) + } +} + +/** Facet feature for a URL. +The text URL may have been simplified or truncated, but the facet reference should be a complete URL.*/ +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Link<'a> { + #[serde(borrow)] + pub uri: jacquard_common::types::string::Uri<'a>, +} + +pub mod link_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Uri; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Uri = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Uri = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); + } +} + +/// Builder for constructing an instance of this type +pub struct LinkBuilder<'a, S: link_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Link<'a> { + /// Create a new builder for this type + pub fn new() -> LinkBuilder<'a, link_state::Empty> { + LinkBuilder::new() + } +} + +impl<'a> LinkBuilder<'a, link_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + LinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LinkBuilder<'a, S> +where + S: link_state::State, + S::Uri: link_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into>, + ) -> LinkBuilder<'a, link_state::SetUri> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + LinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LinkBuilder<'a, S> +where + S: link_state::State, + S::Uri: link_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Link<'a> { + Link { + uri: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Link<'a> { + Link { + uri: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.richtext.facet" + } + fn def_name() -> &'static str { + "link" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_richtext_facet() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/** Annotation of a sub-string within rich text. +Extends Bluesky's facet system to support DeckBelcher-specific features.*/ +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Facet<'a> { + #[serde(borrow)] + pub features: Vec>, + #[serde(borrow)] + pub index: crate::com_deckbelcher::richtext::facet::ByteSlice<'a>, +} + +pub mod facet_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Features; + type Index; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Features = Unset; + type Index = Unset; + } + ///State transition - sets the `features` field to Set + pub struct SetFeatures(PhantomData S>); + impl sealed::Sealed for SetFeatures {} + impl State for SetFeatures { + type Features = Set; + type Index = S::Index; + } + ///State transition - sets the `index` field to Set + pub struct SetIndex(PhantomData S>); + impl sealed::Sealed for SetIndex {} + impl State for SetIndex { + type Features = S::Features; + type Index = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `features` field + pub struct features(()); + ///Marker type for the `index` field + pub struct index(()); + } +} + +/// Builder for constructing an instance of this type +pub struct FacetBuilder<'a, S: facet_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option>>, + ::core::option::Option>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Facet<'a> { + /// Create a new builder for this type + pub fn new() -> FacetBuilder<'a, facet_state::Empty> { + FacetBuilder::new() + } +} + +impl<'a> FacetBuilder<'a, facet_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + FacetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> FacetBuilder<'a, S> +where + S: facet_state::State, + S::Features: facet_state::IsUnset, +{ + /// Set the `features` field (required) + pub fn features( + mut self, + value: impl Into>>, + ) -> FacetBuilder<'a, facet_state::SetFeatures> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + FacetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> FacetBuilder<'a, S> +where + S: facet_state::State, + S::Index: facet_state::IsUnset, +{ + /// Set the `index` field (required) + pub fn index( + mut self, + value: impl Into>, + ) -> FacetBuilder<'a, facet_state::SetIndex> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + FacetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> FacetBuilder<'a, S> +where + S: facet_state::State, + S::Features: facet_state::IsSet, + S::Index: facet_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Facet<'a> { + Facet { + features: self.__unsafe_private_named.0.unwrap(), + index: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Facet<'a> { + Facet { + features: self.__unsafe_private_named.0.unwrap(), + index: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(tag = "$type")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum FacetFeaturesItem<'a> { + #[serde(rename = "com.deckbelcher.richtext.facet#mention")] + Mention(Box>), + #[serde(rename = "com.deckbelcher.richtext.facet#link")] + Link(Box>), + #[serde(rename = "com.deckbelcher.richtext.facet#tag")] + Tag(Box>), +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.richtext.facet" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_richtext_facet() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/** Facet feature for mention of another account. +The text is usually a handle, including an `@` prefix, but the facet reference is a DID.*/ +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Mention<'a> { + #[serde(borrow)] + pub did: jacquard_common::types::string::Did<'a>, +} + +pub mod mention_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Did; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Did = Unset; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Did = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `did` field + pub struct did(()); + } +} + +/// Builder for constructing an instance of this type +pub struct MentionBuilder<'a, S: mention_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Mention<'a> { + /// Create a new builder for this type + pub fn new() -> MentionBuilder<'a, mention_state::Empty> { + MentionBuilder::new() + } +} + +impl<'a> MentionBuilder<'a, mention_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + MentionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> MentionBuilder<'a, S> +where + S: mention_state::State, + S::Did: mention_state::IsUnset, +{ + /// Set the `did` field (required) + pub fn did( + mut self, + value: impl Into>, + ) -> MentionBuilder<'a, mention_state::SetDid> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + MentionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> MentionBuilder<'a, S> +where + S: mention_state::State, + S::Did: mention_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Mention<'a> { + Mention { + did: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Mention<'a> { + Mention { + did: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Mention<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.richtext.facet" + } + fn def_name() -> &'static str { + "mention" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_richtext_facet() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/** Facet feature for a hashtag. +The text usually includes a '#' prefix, but the facet reference should not.*/ +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct Tag<'a> { + #[serde(borrow)] + pub tag: jacquard_common::CowStr<'a>, +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Tag<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.richtext.facet" + } + fn def_name() -> &'static str { + "tag" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_richtext_facet() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.tag; + #[allow(unused_comparisons)] + if ::len(value.as_ref()) > 640usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tag", + ), + max: 640usize, + actual: ::len(value.as_ref()), + }); + } + } + { + let value = &self.tag; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tag", + ), + max: 64usize, + actual: count, + }); + } + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/social.rs b/crates/weaver-api/src/com_deckbelcher/social.rs new file mode 100644 index 0000000..0fc1bee --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/social.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod like; \ No newline at end of file diff --git a/crates/weaver-api/src/com_deckbelcher/social/like.rs b/crates/weaver-api/src/com_deckbelcher/social/like.rs new file mode 100644 index 0000000..55cc9b0 --- /dev/null +++ b/crates/weaver-api/src/com_deckbelcher/social/like.rs @@ -0,0 +1,317 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: com.deckbelcher.social.like +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Record declaring a 'like' of a piece of content (decklist, reply, etc). +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Like<'a> { + /// Timestamp when the like was created. + pub created_at: jacquard_common::types::string::Datetime, + /// Reference to the content being liked. + #[serde(borrow)] + pub subject: crate::com_atproto::repo::strong_ref::StrongRef<'a>, +} + +pub mod like_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Subject; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Subject = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type Subject = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Subject = S::Subject; + type CreatedAt = Set; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `subject` field + pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct LikeBuilder<'a, S: like_state::State> { + _phantom_state: ::core::marker::PhantomData S>, + __unsafe_private_named: ( + ::core::option::Option, + ::core::option::Option>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Like<'a> { + /// Create a new builder for this type + pub fn new() -> LikeBuilder<'a, like_state::Empty> { + LikeBuilder::new() + } +} + +impl<'a> LikeBuilder<'a, like_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + LikeBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LikeBuilder<'a, S> +where + S: like_state::State, + S::CreatedAt: like_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into, + ) -> LikeBuilder<'a, like_state::SetCreatedAt> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + LikeBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LikeBuilder<'a, S> +where + S: like_state::State, + S::Subject: like_state::IsUnset, +{ + /// Set the `subject` field (required) + pub fn subject( + mut self, + value: impl Into>, + ) -> LikeBuilder<'a, like_state::SetSubject> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + LikeBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LikeBuilder<'a, S> +where + S: like_state::State, + S::Subject: like_state::IsSet, + S::CreatedAt: like_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Like<'a> { + Like { + created_at: self.__unsafe_private_named.0.unwrap(), + subject: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Like<'a> { + Like { + created_at: self.__unsafe_private_named.0.unwrap(), + subject: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Like<'a> { + pub fn uri( + uri: impl Into>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, LikeRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct LikeGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Like<'a>, +} + +impl From> for Like<'_> { + fn from(output: LikeGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Like<'_> { + const NSID: &'static str = "com.deckbelcher.social.like"; + type Record = LikeRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct LikeRecord; +impl jacquard_common::xrpc::XrpcResp for LikeRecord { + const NSID: &'static str = "com.deckbelcher.social.like"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = LikeGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for LikeRecord { + const NSID: &'static str = "com.deckbelcher.social.like"; + type Record = LikeRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Like<'a> { + fn nsid() -> &'static str { + "com.deckbelcher.social.like" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_com_deckbelcher_social_like() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_com_deckbelcher_social_like() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("com.deckbelcher.social.like"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Record declaring a 'like' of a piece of content (decklist, reply, etc).", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("subject"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the like was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("subject"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/weaver-api/src/com_whtwnd/blog.rs b/crates/weaver-api/src/com_whtwnd/blog.rs index a43ea62..48f3179 100644 --- a/crates/weaver-api/src/com_whtwnd/blog.rs +++ b/crates/weaver-api/src/com_whtwnd/blog.rs @@ -163,7 +163,7 @@ fn lexicon_doc_com_whtwnd_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobMetadata"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -174,7 +174,7 @@ fn lexicon_doc_com_whtwnd_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobref"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -212,7 +212,7 @@ fn lexicon_doc_com_whtwnd_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -264,7 +264,7 @@ fn lexicon_doc_com_whtwnd_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -311,7 +311,7 @@ fn lexicon_doc_com_whtwnd_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -372,7 +372,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlobMetadata<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -408,7 +408,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlogEntry<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.content; #[allow(unused_comparisons)] @@ -454,37 +454,37 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EntryUri; type Content; + type EntryUri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EntryUri = Unset; type Content = Unset; - } - ///State transition - sets the `entry_uri` field to Set - pub struct SetEntryUri(PhantomData S>); - impl sealed::Sealed for SetEntryUri {} - impl State for SetEntryUri { - type EntryUri = Set; - type Content = S::Content; + type EntryUri = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { - type EntryUri = S::EntryUri; type Content = Set; + type EntryUri = S::EntryUri; + } + ///State transition - sets the `entry_uri` field to Set + pub struct SetEntryUri(PhantomData S>); + impl sealed::Sealed for SetEntryUri {} + impl State for SetEntryUri { + type Content = S::Content; + type EntryUri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `entry_uri` field - pub struct entry_uri(()); ///Marker type for the `content` field pub struct content(()); + ///Marker type for the `entry_uri` field + pub struct entry_uri(()); } } @@ -557,8 +557,8 @@ where impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::EntryUri: comment_state::IsSet, S::Content: comment_state::IsSet, + S::EntryUri: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { @@ -596,7 +596,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.content; #[allow(unused_comparisons)] @@ -783,7 +783,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Ogp<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/com_whtwnd/blog/entry.rs b/crates/weaver-api/src/com_whtwnd/blog/entry.rs index 71d5dc9..7fb1629 100644 --- a/crates/weaver-api/src/com_whtwnd/blog/entry.rs +++ b/crates/weaver-api/src/com_whtwnd/blog/entry.rs @@ -392,7 +392,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entry<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.content; #[allow(unused_comparisons)] @@ -443,7 +443,7 @@ fn lexicon_doc_com_whtwnd_blog_entry() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -461,7 +461,7 @@ fn lexicon_doc_com_whtwnd_blog_entry() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobs"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { diff --git a/crates/weaver-api/src/com_whtwnd/blog/get_entry_metadata_by_name.rs b/crates/weaver-api/src/com_whtwnd/blog/get_entry_metadata_by_name.rs index 35214fc..c6dc8df 100644 --- a/crates/weaver-api/src/com_whtwnd/blog/get_entry_metadata_by_name.rs +++ b/crates/weaver-api/src/com_whtwnd/blog/get_entry_metadata_by_name.rs @@ -200,8 +200,8 @@ pub enum GetEntryMetadataByNameError<'a> { NotFound(std::option::Option>), } -impl std::fmt::Display for GetEntryMetadataByNameError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetEntryMetadataByNameError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotFound(msg) => { write!(f, "NotFound")?; diff --git a/crates/weaver-api/src/com_whtwnd/blog/notify_of_new_entry.rs b/crates/weaver-api/src/com_whtwnd/blog/notify_of_new_entry.rs index 18af999..c5798e6 100644 --- a/crates/weaver-api/src/com_whtwnd/blog/notify_of_new_entry.rs +++ b/crates/weaver-api/src/com_whtwnd/blog/notify_of_new_entry.rs @@ -154,8 +154,8 @@ pub struct NotifyOfNewEntryOutput<'a> {} #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum NotifyOfNewEntryError<'a> {} -impl std::fmt::Display for NotifyOfNewEntryError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for NotifyOfNewEntryError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } diff --git a/crates/weaver-api/src/lib.rs b/crates/weaver-api/src/lib.rs index 8a7bcaf..fb8040b 100644 --- a/crates/weaver-api/src/lib.rs +++ b/crates/weaver-api/src/lib.rs @@ -3,6 +3,7 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +extern crate alloc; #[cfg(feature = "app_bsky")] pub mod app_bsky; @@ -16,6 +17,9 @@ pub mod chat_bsky; #[cfg(feature = "com_atproto")] pub mod com_atproto; +#[cfg(feature = "com_deckbelcher")] +pub mod com_deckbelcher; + #[cfg(feature = "com_whtwnd")] pub mod com_whtwnd; diff --git a/crates/weaver-api/src/pub_leaflet/blocks/blockquote.rs b/crates/weaver-api/src/pub_leaflet/blocks/blockquote.rs index 38c071b..5113228 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/blockquote.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/blockquote.rs @@ -34,7 +34,7 @@ fn lexicon_doc_pub_leaflet_blocks_blockquote() -> ::jacquard_lexicon::lexicon::L revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -47,7 +47,7 @@ fn lexicon_doc_pub_leaflet_blocks_blockquote() -> ::jacquard_lexicon::lexicon::L nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("facets"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -100,7 +100,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Blockquote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/bsky_post.rs b/crates/weaver-api/src/pub_leaflet/blocks/bsky_post.rs index 2781935..9a9b12b 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/bsky_post.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/bsky_post.rs @@ -135,7 +135,7 @@ fn lexicon_doc_pub_leaflet_blocks_bskyPost() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_pub_leaflet_blocks_bskyPost() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("postRef"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -177,7 +177,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BskyPost<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/button.rs b/crates/weaver-api/src/pub_leaflet/blocks/button.rs index fc84bb3..b8513dd 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/button.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/button.rs @@ -172,7 +172,7 @@ fn lexicon_doc_pub_leaflet_blocks_button() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_pub_leaflet_blocks_button() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("text"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -240,7 +240,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Button<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/code.rs b/crates/weaver-api/src/pub_leaflet/blocks/code.rs index cbf205e..a3846e2 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/code.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/code.rs @@ -37,7 +37,7 @@ fn lexicon_doc_pub_leaflet_blocks_code() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -50,7 +50,7 @@ fn lexicon_doc_pub_leaflet_blocks_code() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("language"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -121,7 +121,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/header.rs b/crates/weaver-api/src/pub_leaflet/blocks/header.rs index 7923893..3abface 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/header.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/header.rs @@ -36,7 +36,7 @@ fn lexicon_doc_pub_leaflet_blocks_header() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -49,7 +49,7 @@ fn lexicon_doc_pub_leaflet_blocks_header() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("facets"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -113,7 +113,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Header<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.level { if *value > 6i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { diff --git a/crates/weaver-api/src/pub_leaflet/blocks/horizontal_rule.rs b/crates/weaver-api/src/pub_leaflet/blocks/horizontal_rule.rs index 857ea29..08db3e4 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/horizontal_rule.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/horizontal_rule.rs @@ -27,7 +27,7 @@ fn lexicon_doc_pub_leaflet_blocks_horizontalRule() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -36,7 +36,7 @@ fn lexicon_doc_pub_leaflet_blocks_horizontalRule() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -58,7 +58,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HorizontalRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/iframe.rs b/crates/weaver-api/src/pub_leaflet/blocks/iframe.rs index 7c3c817..60140d6 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/iframe.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/iframe.rs @@ -153,7 +153,7 @@ fn lexicon_doc_pub_leaflet_blocks_iframe() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -164,7 +164,7 @@ fn lexicon_doc_pub_leaflet_blocks_iframe() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -214,7 +214,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Iframe<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.height { if *value > 1600i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { diff --git a/crates/weaver-api/src/pub_leaflet/blocks/image.rs b/crates/weaver-api/src/pub_leaflet/blocks/image.rs index 49f6b10..823750d 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/image.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/image.rs @@ -31,37 +31,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Width; type Height; + type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Width = Unset; type Height = Unset; - } - ///State transition - sets the `width` field to Set - pub struct SetWidth(PhantomData S>); - impl sealed::Sealed for SetWidth {} - impl State for SetWidth { - type Width = Set; - type Height = S::Height; + type Width = Unset; } ///State transition - sets the `height` field to Set pub struct SetHeight(PhantomData S>); impl sealed::Sealed for SetHeight {} impl State for SetHeight { - type Width = S::Width; type Height = Set; + type Width = S::Width; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth(PhantomData S>); + impl sealed::Sealed for SetWidth {} + impl State for SetWidth { + type Height = S::Height; + type Width = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `width` field - pub struct width(()); ///Marker type for the `height` field pub struct height(()); + ///Marker type for the `width` field + pub struct width(()); } } @@ -131,8 +131,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Width: aspect_ratio_state::IsSet, S::Height: aspect_ratio_state::IsSet, + S::Width: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { @@ -167,7 +167,7 @@ fn lexicon_doc_pub_leaflet_blocks_image() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -181,7 +181,7 @@ fn lexicon_doc_pub_leaflet_blocks_image() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -221,7 +221,7 @@ fn lexicon_doc_pub_leaflet_blocks_image() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -279,7 +279,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AspectRatio<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -316,37 +316,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Image; type AspectRatio; + type Image; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Image = Unset; type AspectRatio = Unset; - } - ///State transition - sets the `image` field to Set - pub struct SetImage(PhantomData S>); - impl sealed::Sealed for SetImage {} - impl State for SetImage { - type Image = Set; - type AspectRatio = S::AspectRatio; + type Image = Unset; } ///State transition - sets the `aspect_ratio` field to Set pub struct SetAspectRatio(PhantomData S>); impl sealed::Sealed for SetAspectRatio {} impl State for SetAspectRatio { - type Image = S::Image; type AspectRatio = Set; + type Image = S::Image; + } + ///State transition - sets the `image` field to Set + pub struct SetImage(PhantomData S>); + impl sealed::Sealed for SetImage {} + impl State for SetImage { + type AspectRatio = S::AspectRatio; + type Image = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `image` field - pub struct image(()); ///Marker type for the `aspect_ratio` field pub struct aspect_ratio(()); + ///Marker type for the `image` field + pub struct image(()); } } @@ -433,8 +433,8 @@ where impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Image: image_state::IsSet, S::AspectRatio: image_state::IsSet, + S::Image: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { @@ -474,7 +474,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/math.rs b/crates/weaver-api/src/pub_leaflet/blocks/math.rs index 586f524..9180ae8 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/math.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/math.rs @@ -31,7 +31,7 @@ fn lexicon_doc_pub_leaflet_blocks_math() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -42,7 +42,7 @@ fn lexicon_doc_pub_leaflet_blocks_math() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("tex"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -79,7 +79,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Math<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/page.rs b/crates/weaver-api/src/pub_leaflet/blocks/page.rs index 831b515..18f5ee3 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/page.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/page.rs @@ -31,7 +31,7 @@ fn lexicon_doc_pub_leaflet_blocks_page() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -42,7 +42,7 @@ fn lexicon_doc_pub_leaflet_blocks_page() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -79,7 +79,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Page<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/poll.rs b/crates/weaver-api/src/pub_leaflet/blocks/poll.rs index be65b3f..bb56e16 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/poll.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/poll.rs @@ -135,7 +135,7 @@ fn lexicon_doc_pub_leaflet_blocks_poll() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_pub_leaflet_blocks_poll() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("pollRef"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -177,7 +177,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Poll<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/text.rs b/crates/weaver-api/src/pub_leaflet/blocks/text.rs index 018d6a7..98f8d62 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/text.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/text.rs @@ -34,7 +34,7 @@ fn lexicon_doc_pub_leaflet_blocks_text() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -47,7 +47,7 @@ fn lexicon_doc_pub_leaflet_blocks_text() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("facets"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -100,7 +100,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Text<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/unordered_list.rs b/crates/weaver-api/src/pub_leaflet/blocks/unordered_list.rs index fe14581..1e5882f 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/unordered_list.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/unordered_list.rs @@ -187,7 +187,7 @@ fn lexicon_doc_pub_leaflet_blocks_unorderedList() -> ::jacquard_lexicon::lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("listItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -198,7 +198,7 @@ fn lexicon_doc_pub_leaflet_blocks_unorderedList() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("children"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -239,7 +239,7 @@ fn lexicon_doc_pub_leaflet_blocks_unorderedList() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("children"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -273,7 +273,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -413,7 +413,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UnorderedList<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/blocks/website.rs b/crates/weaver-api/src/pub_leaflet/blocks/website.rs index d4952e2..4e5c200 100644 --- a/crates/weaver-api/src/pub_leaflet/blocks/website.rs +++ b/crates/weaver-api/src/pub_leaflet/blocks/website.rs @@ -207,7 +207,7 @@ fn lexicon_doc_pub_leaflet_blocks_website() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -218,7 +218,7 @@ fn lexicon_doc_pub_leaflet_blocks_website() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -299,7 +299,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Website<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/comment.rs b/crates/weaver-api/src/pub_leaflet/comment.rs index 8e9c668..c24a62d 100644 --- a/crates/weaver-api/src/pub_leaflet/comment.rs +++ b/crates/weaver-api/src/pub_leaflet/comment.rs @@ -172,7 +172,7 @@ fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("linearDocumentQuote"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -186,7 +186,7 @@ fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("document"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -238,7 +238,7 @@ fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "attachment", @@ -355,7 +355,7 @@ fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("parent"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -394,7 +394,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinearDocumentQuote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -443,51 +443,51 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Plaintext; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Plaintext = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; - type Plaintext = S::Plaintext; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `plaintext` field to Set pub struct SetPlaintext(PhantomData S>); impl sealed::Sealed for SetPlaintext {} impl State for SetPlaintext { - type CreatedAt = S::CreatedAt; type Plaintext = Set; type Subject = S::Subject; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type CreatedAt = S::CreatedAt; type Plaintext = S::Plaintext; type Subject = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Plaintext = S::Plaintext; + type Subject = S::Subject; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `plaintext` field pub struct plaintext(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -657,9 +657,9 @@ where impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::CreatedAt: comment_state::IsSet, S::Plaintext: comment_state::IsSet, S::Subject: comment_state::IsSet, + S::CreatedAt: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { @@ -768,7 +768,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -906,7 +906,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/document.rs b/crates/weaver-api/src/pub_leaflet/document.rs index 4b6c46a..cf77d80 100644 --- a/crates/weaver-api/src/pub_leaflet/document.rs +++ b/crates/weaver-api/src/pub_leaflet/document.rs @@ -55,51 +55,51 @@ pub mod document_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Title; type Pages; type Author; - type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Title = Unset; type Pages = Unset; type Author = Unset; - type Title = Unset; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle(PhantomData S>); + impl sealed::Sealed for SetTitle {} + impl State for SetTitle { + type Title = Set; + type Pages = S::Pages; + type Author = S::Author; } ///State transition - sets the `pages` field to Set pub struct SetPages(PhantomData S>); impl sealed::Sealed for SetPages {} impl State for SetPages { + type Title = S::Title; type Pages = Set; type Author = S::Author; - type Title = S::Title; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type Pages = S::Pages; - type Author = Set; type Title = S::Title; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle(PhantomData S>); - impl sealed::Sealed for SetTitle {} - impl State for SetTitle { type Pages = S::Pages; - type Author = S::Author; - type Title = Set; + type Author = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `pages` field pub struct pages(()); ///Marker type for the `author` field pub struct author(()); - ///Marker type for the `title` field - pub struct title(()); } } @@ -322,9 +322,9 @@ where impl<'a, S> DocumentBuilder<'a, S> where S: document_state::State, + S::Title: document_state::IsSet, S::Pages: document_state::IsSet, S::Author: document_state::IsSet, - S::Title: document_state::IsSet, { /// Build the final struct pub fn build(self) -> Document<'a> { @@ -456,7 +456,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Document<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -532,7 +532,7 @@ fn lexicon_doc_pub_leaflet_document() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -554,7 +554,7 @@ fn lexicon_doc_pub_leaflet_document() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { diff --git a/crates/weaver-api/src/pub_leaflet/graph/subscription.rs b/crates/weaver-api/src/pub_leaflet/graph/subscription.rs index dfa808d..cd8340e 100644 --- a/crates/weaver-api/src/pub_leaflet/graph/subscription.rs +++ b/crates/weaver-api/src/pub_leaflet/graph/subscription.rs @@ -200,7 +200,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Subscription<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -214,7 +214,7 @@ fn lexicon_doc_pub_leaflet_graph_subscription() -> ::jacquard_lexicon::lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -234,7 +234,7 @@ fn lexicon_doc_pub_leaflet_graph_subscription() -> ::jacquard_lexicon::lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "publication", diff --git a/crates/weaver-api/src/pub_leaflet/pages/canvas.rs b/crates/weaver-api/src/pub_leaflet/pages/canvas.rs index 1fd168b..734fbce 100644 --- a/crates/weaver-api/src/pub_leaflet/pages/canvas.rs +++ b/crates/weaver-api/src/pub_leaflet/pages/canvas.rs @@ -39,67 +39,67 @@ pub mod block_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Y; type Width; - type X; + type Y; type Block; + type X; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Y = Unset; type Width = Unset; - type X = Unset; + type Y = Unset; type Block = Unset; - } - ///State transition - sets the `y` field to Set - pub struct SetY(PhantomData S>); - impl sealed::Sealed for SetY {} - impl State for SetY { - type Y = Set; - type Width = S::Width; - type X = S::X; - type Block = S::Block; + type X = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth(PhantomData S>); impl sealed::Sealed for SetWidth {} impl State for SetWidth { - type Y = S::Y; type Width = Set; - type X = S::X; + type Y = S::Y; type Block = S::Block; + type X = S::X; } - ///State transition - sets the `x` field to Set - pub struct SetX(PhantomData S>); - impl sealed::Sealed for SetX {} - impl State for SetX { - type Y = S::Y; + ///State transition - sets the `y` field to Set + pub struct SetY(PhantomData S>); + impl sealed::Sealed for SetY {} + impl State for SetY { type Width = S::Width; - type X = Set; + type Y = Set; type Block = S::Block; + type X = S::X; } ///State transition - sets the `block` field to Set pub struct SetBlock(PhantomData S>); impl sealed::Sealed for SetBlock {} impl State for SetBlock { - type Y = S::Y; type Width = S::Width; - type X = S::X; + type Y = S::Y; type Block = Set; + type X = S::X; + } + ///State transition - sets the `x` field to Set + pub struct SetX(PhantomData S>); + impl sealed::Sealed for SetX {} + impl State for SetX { + type Width = S::Width; + type Y = S::Y; + type Block = S::Block; + type X = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `y` field - pub struct y(()); ///Marker type for the `width` field pub struct width(()); - ///Marker type for the `x` field - pub struct x(()); + ///Marker type for the `y` field + pub struct y(()); ///Marker type for the `block` field pub struct block(()); + ///Marker type for the `x` field + pub struct x(()); } } @@ -234,10 +234,10 @@ where impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, - S::Y: block_state::IsSet, S::Width: block_state::IsSet, - S::X: block_state::IsSet, + S::Y: block_state::IsSet, S::Block: block_state::IsSet, + S::X: block_state::IsSet, { /// Build the final struct pub fn build(self) -> Block<'a> { @@ -323,7 +323,7 @@ fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -339,7 +339,7 @@ fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -432,7 +432,7 @@ fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocks"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -477,7 +477,7 @@ fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -522,7 +522,7 @@ fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("end"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -576,7 +576,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Block<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -733,7 +733,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Canvas<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -906,7 +906,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Position<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -939,37 +939,37 @@ pub mod quote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Start; type End; + type Start; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Start = Unset; type End = Unset; - } - ///State transition - sets the `start` field to Set - pub struct SetStart(PhantomData S>); - impl sealed::Sealed for SetStart {} - impl State for SetStart { - type Start = Set; - type End = S::End; + type Start = Unset; } ///State transition - sets the `end` field to Set pub struct SetEnd(PhantomData S>); impl sealed::Sealed for SetEnd {} impl State for SetEnd { - type Start = S::Start; type End = Set; + type Start = S::Start; + } + ///State transition - sets the `start` field to Set + pub struct SetStart(PhantomData S>); + impl sealed::Sealed for SetStart {} + impl State for SetStart { + type End = S::End; + type Start = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `start` field - pub struct start(()); ///Marker type for the `end` field pub struct end(()); + ///Marker type for the `start` field + pub struct start(()); } } @@ -1042,8 +1042,8 @@ where impl<'a, S> QuoteBuilder<'a, S> where S: quote_state::State, - S::Start: quote_state::IsSet, S::End: quote_state::IsSet, + S::Start: quote_state::IsSet, { /// Build the final struct pub fn build(self) -> Quote<'a> { @@ -1081,7 +1081,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Quote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/pub_leaflet/pages/linear_document.rs b/crates/weaver-api/src/pub_leaflet/pages/linear_document.rs index 53222a6..82cc3f8 100644 --- a/crates/weaver-api/src/pub_leaflet/pages/linear_document.rs +++ b/crates/weaver-api/src/pub_leaflet/pages/linear_document.rs @@ -19,7 +19,7 @@ pub struct Block<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub alignment: std::option::Option>, + pub alignment: std::option::Option>, #[serde(borrow)] pub block: BlockBlock<'a>, } @@ -60,7 +60,7 @@ pub mod block_state { pub struct BlockBuilder<'a, S: block_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -86,18 +86,12 @@ impl<'a> BlockBuilder<'a, block_state::Empty> { impl<'a, S: block_state::State> BlockBuilder<'a, S> { /// Set the `alignment` field (optional) - pub fn alignment( - mut self, - value: impl Into>>, - ) -> Self { + pub fn alignment(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `alignment` field to an Option value (optional) - pub fn maybe_alignment( - mut self, - value: Option>, - ) -> Self { + pub fn maybe_alignment(mut self, value: Option>) -> Self { self.__unsafe_private_named.0 = value; self } @@ -151,6 +145,104 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum BlockAlignment<'a> { + TextAlignLeft, + TextAlignCenter, + TextAlignRight, + TextAlignJustify, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> BlockAlignment<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::TextAlignLeft => "#textAlignLeft", + Self::TextAlignCenter => "#textAlignCenter", + Self::TextAlignRight => "#textAlignRight", + Self::TextAlignJustify => "#textAlignJustify", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for BlockAlignment<'a> { + fn from(s: &'a str) -> Self { + match s { + "#textAlignLeft" => Self::TextAlignLeft, + "#textAlignCenter" => Self::TextAlignCenter, + "#textAlignRight" => Self::TextAlignRight, + "#textAlignJustify" => Self::TextAlignJustify, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for BlockAlignment<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "#textAlignLeft" => Self::TextAlignLeft, + "#textAlignCenter" => Self::TextAlignCenter, + "#textAlignRight" => Self::TextAlignRight, + "#textAlignJustify" => Self::TextAlignJustify, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for BlockAlignment<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for BlockAlignment<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for BlockAlignment<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for BlockAlignment<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for BlockAlignment<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for BlockAlignment<'_> { + type Output = BlockAlignment<'static>; + fn into_static(self) -> Self::Output { + match self { + BlockAlignment::TextAlignLeft => BlockAlignment::TextAlignLeft, + BlockAlignment::TextAlignCenter => BlockAlignment::TextAlignCenter, + BlockAlignment::TextAlignRight => BlockAlignment::TextAlignRight, + BlockAlignment::TextAlignJustify => BlockAlignment::TextAlignJustify, + BlockAlignment::Other(v) => BlockAlignment::Other(v.into_static()), + } + } +} + #[jacquard_derive::open_union] #[derive( serde::Serialize, @@ -203,7 +295,7 @@ fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -214,7 +306,7 @@ fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "alignment", @@ -269,7 +361,7 @@ fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocks"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -314,7 +406,7 @@ fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -359,7 +451,7 @@ fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("end"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -419,7 +511,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Block<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -578,7 +670,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinearDocument<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -751,7 +843,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Position<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -926,7 +1018,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Quote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/pub_leaflet/poll/definition.rs b/crates/weaver-api/src/pub_leaflet/poll/definition.rs index 1ad8e62..8d54caf 100644 --- a/crates/weaver-api/src/pub_leaflet/poll/definition.rs +++ b/crates/weaver-api/src/pub_leaflet/poll/definition.rs @@ -36,37 +36,37 @@ pub mod definition_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Options; type Name; + type Options; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Options = Unset; type Name = Unset; - } - ///State transition - sets the `options` field to Set - pub struct SetOptions(PhantomData S>); - impl sealed::Sealed for SetOptions {} - impl State for SetOptions { - type Options = Set; - type Name = S::Name; + type Options = Unset; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { - type Options = S::Options; type Name = Set; + type Options = S::Options; + } + ///State transition - sets the `options` field to Set + pub struct SetOptions(PhantomData S>); + impl sealed::Sealed for SetOptions {} + impl State for SetOptions { + type Name = S::Name; + type Options = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `options` field - pub struct options(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `options` field + pub struct options(()); } } @@ -161,8 +161,8 @@ where impl<'a, S> DefinitionBuilder<'a, S> where S: definition_state::State, - S::Options: definition_state::IsSet, S::Name: definition_state::IsSet, + S::Options: definition_state::IsSet, { /// Build the final struct pub fn build(self) -> Definition<'a> { @@ -263,7 +263,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Definition<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.name; #[allow(unused_comparisons)] @@ -309,7 +309,7 @@ fn lexicon_doc_pub_leaflet_poll_definition() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -328,7 +328,7 @@ fn lexicon_doc_pub_leaflet_poll_definition() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("endDate"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -386,7 +386,7 @@ fn lexicon_doc_pub_leaflet_poll_definition() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("text"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -441,7 +441,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DefinitionOption<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.text { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 500usize { diff --git a/crates/weaver-api/src/pub_leaflet/poll/vote.rs b/crates/weaver-api/src/pub_leaflet/poll/vote.rs index 0a30382..9e9c9e4 100644 --- a/crates/weaver-api/src/pub_leaflet/poll/vote.rs +++ b/crates/weaver-api/src/pub_leaflet/poll/vote.rs @@ -34,37 +34,37 @@ pub mod vote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Poll; type Option; + type Poll; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Poll = Unset; type Option = Unset; - } - ///State transition - sets the `poll` field to Set - pub struct SetPoll(PhantomData S>); - impl sealed::Sealed for SetPoll {} - impl State for SetPoll { - type Poll = Set; - type Option = S::Option; + type Poll = Unset; } ///State transition - sets the `option` field to Set pub struct SetOption(PhantomData S>); impl sealed::Sealed for SetOption {} impl State for SetOption { - type Poll = S::Poll; type Option = Set; + type Poll = S::Poll; + } + ///State transition - sets the `poll` field to Set + pub struct SetPoll(PhantomData S>); + impl sealed::Sealed for SetPoll {} + impl State for SetPoll { + type Option = S::Option; + type Poll = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `poll` field - pub struct poll(()); ///Marker type for the `option` field pub struct option(()); + ///Marker type for the `poll` field + pub struct poll(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> VoteBuilder<'a, S> where S: vote_state::State, - S::Poll: vote_state::IsSet, S::Option: vote_state::IsSet, + S::Poll: vote_state::IsSet, { /// Build the final struct pub fn build(self) -> Vote<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Vote<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_pub_leaflet_poll_vote() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_pub_leaflet_poll_vote() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("option"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { diff --git a/crates/weaver-api/src/pub_leaflet/publication.rs b/crates/weaver-api/src/pub_leaflet/publication.rs index 4f54112..9fcd055 100644 --- a/crates/weaver-api/src/pub_leaflet/publication.rs +++ b/crates/weaver-api/src/pub_leaflet/publication.rs @@ -18,8 +18,6 @@ )] #[serde(rename_all = "camelCase")] pub struct Publication<'a> { - // NOTE: Leaflet uses snake_case here, breaking ATProto camelCase convention - #[serde(rename = "base_path")] #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub base_path: std::option::Option>, @@ -329,7 +327,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Publication<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2000usize { @@ -368,7 +366,7 @@ fn lexicon_doc_pub_leaflet_publication() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -388,7 +386,7 @@ fn lexicon_doc_pub_leaflet_publication() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "base_path", @@ -475,7 +473,7 @@ fn lexicon_doc_pub_leaflet_publication() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "showComments", @@ -508,7 +506,7 @@ fn lexicon_doc_pub_leaflet_publication() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accentBackground", @@ -633,7 +631,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Preferences<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -782,7 +780,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/richtext/facet.rs b/crates/weaver-api/src/pub_leaflet/richtext/facet.rs index 0bb8693..488179a 100644 --- a/crates/weaver-api/src/pub_leaflet/richtext/facet.rs +++ b/crates/weaver-api/src/pub_leaflet/richtext/facet.rs @@ -136,7 +136,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atMention"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -151,7 +151,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atURI"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -185,7 +185,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -207,7 +207,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -248,7 +248,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -267,7 +267,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -301,7 +301,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -318,7 +318,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -350,7 +350,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -369,7 +369,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -406,7 +406,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("features"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -454,7 +454,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -471,7 +471,7 @@ fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -493,7 +493,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AtMention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -524,7 +524,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -695,7 +695,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.byte_end; if *value < 0i64 { @@ -750,7 +750,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -889,7 +889,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DidMention<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -920,7 +920,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Highlight<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -956,7 +956,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -987,7 +987,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1022,7 +1022,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1233,7 +1233,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1264,7 +1264,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strikethrough<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1295,7 +1295,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/theme/background_image.rs b/crates/weaver-api/src/pub_leaflet/theme/background_image.rs index 4e22ea1..0a40c55 100644 --- a/crates/weaver-api/src/pub_leaflet/theme/background_image.rs +++ b/crates/weaver-api/src/pub_leaflet/theme/background_image.rs @@ -171,7 +171,7 @@ fn lexicon_doc_pub_leaflet_theme_backgroundImage() -> ::jacquard_lexicon::lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -182,7 +182,7 @@ fn lexicon_doc_pub_leaflet_theme_backgroundImage() -> ::jacquard_lexicon::lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -231,7 +231,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BackgroundImage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/pub_leaflet/theme/color.rs b/crates/weaver-api/src/pub_leaflet/theme/color.rs index 591f68b..5a4de7a 100644 --- a/crates/weaver-api/src/pub_leaflet/theme/color.rs +++ b/crates/weaver-api/src/pub_leaflet/theme/color.rs @@ -32,51 +32,51 @@ pub mod rgb_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type R; type G; type B; + type R; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type R = Unset; type G = Unset; type B = Unset; - } - ///State transition - sets the `r` field to Set - pub struct SetR(PhantomData S>); - impl sealed::Sealed for SetR {} - impl State for SetR { - type R = Set; - type G = S::G; - type B = S::B; + type R = Unset; } ///State transition - sets the `g` field to Set pub struct SetG(PhantomData S>); impl sealed::Sealed for SetG {} impl State for SetG { - type R = S::R; type G = Set; type B = S::B; + type R = S::R; } ///State transition - sets the `b` field to Set pub struct SetB(PhantomData S>); impl sealed::Sealed for SetB {} impl State for SetB { - type R = S::R; type G = S::G; type B = Set; + type R = S::R; + } + ///State transition - sets the `r` field to Set + pub struct SetR(PhantomData S>); + impl sealed::Sealed for SetR {} + impl State for SetR { + type G = S::G; + type B = S::B; + type R = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `r` field - pub struct r(()); ///Marker type for the `g` field pub struct g(()); ///Marker type for the `b` field pub struct b(()); + ///Marker type for the `r` field + pub struct r(()); } } @@ -160,9 +160,9 @@ where impl<'a, S> RgbBuilder<'a, S> where S: rgb_state::State, - S::R: rgb_state::IsSet, S::G: rgb_state::IsSet, S::B: rgb_state::IsSet, + S::R: rgb_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgb<'a> { @@ -199,7 +199,7 @@ fn lexicon_doc_pub_leaflet_theme_color() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rgb"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -214,7 +214,7 @@ fn lexicon_doc_pub_leaflet_theme_color() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("b"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -267,7 +267,7 @@ fn lexicon_doc_pub_leaflet_theme_color() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("a"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -333,7 +333,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Rgb<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.b; if *value > 255i64 { @@ -438,67 +438,67 @@ pub mod rgba_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type R; type B; type A; type G; - type R; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type R = Unset; type B = Unset; type A = Unset; type G = Unset; - type R = Unset; + } + ///State transition - sets the `r` field to Set + pub struct SetR(PhantomData S>); + impl sealed::Sealed for SetR {} + impl State for SetR { + type R = Set; + type B = S::B; + type A = S::A; + type G = S::G; } ///State transition - sets the `b` field to Set pub struct SetB(PhantomData S>); impl sealed::Sealed for SetB {} impl State for SetB { + type R = S::R; type B = Set; type A = S::A; type G = S::G; - type R = S::R; } ///State transition - sets the `a` field to Set pub struct SetA(PhantomData S>); impl sealed::Sealed for SetA {} impl State for SetA { + type R = S::R; type B = S::B; type A = Set; type G = S::G; - type R = S::R; } ///State transition - sets the `g` field to Set pub struct SetG(PhantomData S>); impl sealed::Sealed for SetG {} impl State for SetG { - type B = S::B; - type A = S::A; - type G = Set; type R = S::R; - } - ///State transition - sets the `r` field to Set - pub struct SetR(PhantomData S>); - impl sealed::Sealed for SetR {} - impl State for SetR { type B = S::B; type A = S::A; - type G = S::G; - type R = Set; + type G = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `r` field + pub struct r(()); ///Marker type for the `b` field pub struct b(()); ///Marker type for the `a` field pub struct a(()); ///Marker type for the `g` field pub struct g(()); - ///Marker type for the `r` field - pub struct r(()); } } @@ -599,10 +599,10 @@ where impl<'a, S> RgbaBuilder<'a, S> where S: rgba_state::State, + S::R: rgba_state::IsSet, S::B: rgba_state::IsSet, S::A: rgba_state::IsSet, S::G: rgba_state::IsSet, - S::R: rgba_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgba<'a> { @@ -644,7 +644,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Rgba<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.a; if *value > 100i64 { diff --git a/crates/weaver-api/src/sh_weaver/actor.rs b/crates/weaver-api/src/sh_weaver/actor.rs index e4b89f9..478dff9 100644 --- a/crates/weaver-api/src/sh_weaver/actor.rs +++ b/crates/weaver-api/src/sh_weaver/actor.rs @@ -164,7 +164,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -179,7 +179,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -235,7 +235,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collaborationCount", @@ -334,7 +334,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "followerCount", @@ -399,7 +399,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -684,7 +684,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -852,7 +852,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("path"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -918,7 +918,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("bluesky"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -1093,7 +1093,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocked"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1246,7 +1246,7 @@ fn lexicon_doc_sh_weaver_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocked"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1401,7 +1401,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Author<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1676,7 +1676,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileDataView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1899,7 +1899,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileDataViewBasic<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1979,37 +1979,37 @@ pub mod profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - type Handle = S::Handle; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { - type Did = S::Did; type Handle = Set; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Handle = S::Handle; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -2388,8 +2388,8 @@ impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> { impl<'a, S> ProfileViewBuilder<'a, S> where S: profile_view_state::State, - S::Did: profile_view_state::IsSet, S::Handle: profile_view_state::IsSet, + S::Did: profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileView<'a> { @@ -2459,7 +2459,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10240usize { @@ -2897,7 +2897,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileViewBasic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.display_name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 640usize { @@ -3111,7 +3111,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubscribedNotebook<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3166,49 +3166,49 @@ pub mod tangled_profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Bluesky; type Did; + type Bluesky; type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Bluesky = Unset; type Did = Unset; + type Bluesky = Unset; type Handle = Unset; } - ///State transition - sets the `bluesky` field to Set - pub struct SetBluesky(PhantomData S>); - impl sealed::Sealed for SetBluesky {} - impl State for SetBluesky { - type Bluesky = Set; - type Did = S::Did; - type Handle = S::Handle; - } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Bluesky = S::Bluesky; type Did = Set; + type Bluesky = S::Bluesky; + type Handle = S::Handle; + } + ///State transition - sets the `bluesky` field to Set + pub struct SetBluesky(PhantomData S>); + impl sealed::Sealed for SetBluesky {} + impl State for SetBluesky { + type Did = S::Did; + type Bluesky = Set; type Handle = S::Handle; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { - type Bluesky = S::Bluesky; type Did = S::Did; + type Bluesky = S::Bluesky; type Handle = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `bluesky` field - pub struct bluesky(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `bluesky` field + pub struct bluesky(()); ///Marker type for the `handle` field pub struct handle(()); } @@ -3400,8 +3400,8 @@ impl<'a, S: tangled_profile_view_state::State> TangledProfileViewBuilder<'a, S> impl<'a, S> TangledProfileViewBuilder<'a, S> where S: tangled_profile_view_state::State, - S::Bluesky: tangled_profile_view_state::IsSet, S::Did: tangled_profile_view_state::IsSet, + S::Bluesky: tangled_profile_view_state::IsSet, S::Handle: tangled_profile_view_state::IsSet, { /// Build the final struct @@ -3452,7 +3452,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TangledProfileView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2560usize { @@ -3644,7 +3644,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3701,7 +3701,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerStateBasic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/actor/profile.rs b/crates/weaver-api/src/sh_weaver/actor/profile.rs index 0d73cb7..88a857f 100644 --- a/crates/weaver-api/src/sh_weaver/actor/profile.rs +++ b/crates/weaver-api/src/sh_weaver/actor/profile.rs @@ -486,7 +486,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10240usize { @@ -614,7 +614,7 @@ fn lexicon_doc_sh_weaver_actor_profile() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -630,7 +630,7 @@ fn lexicon_doc_sh_weaver_actor_profile() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { diff --git a/crates/weaver-api/src/sh_weaver/collab.rs b/crates/weaver-api/src/sh_weaver/collab.rs index c10ea26..d2bf017 100644 --- a/crates/weaver-api/src/sh_weaver/collab.rs +++ b/crates/weaver-api/src/sh_weaver/collab.rs @@ -81,7 +81,7 @@ pub struct CollaborationStateView<'a> { pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>, /// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: CollaborationStateViewStatus<'a>, } pub mod collaboration_state_view_state { @@ -94,51 +94,51 @@ pub mod collaboration_state_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Participants; type Resource; type Status; + type Participants; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Participants = Unset; type Resource = Unset; type Status = Unset; - } - ///State transition - sets the `participants` field to Set - pub struct SetParticipants(PhantomData S>); - impl sealed::Sealed for SetParticipants {} - impl State for SetParticipants { - type Participants = Set; - type Resource = S::Resource; - type Status = S::Status; + type Participants = Unset; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { - type Participants = S::Participants; type Resource = Set; type Status = S::Status; + type Participants = S::Participants; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { - type Participants = S::Participants; type Resource = S::Resource; type Status = Set; + type Participants = S::Participants; + } + ///State transition - sets the `participants` field to Set + pub struct SetParticipants(PhantomData S>); + impl sealed::Sealed for SetParticipants {} + impl State for SetParticipants { + type Resource = S::Resource; + type Status = S::Status; + type Participants = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `participants` field - pub struct participants(()); ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `status` field pub struct status(()); + ///Marker type for the `participants` field + pub struct participants(()); } } @@ -161,7 +161,7 @@ pub struct CollaborationStateViewBuilder<'a, S: collaboration_state_view_state:: Vec>, >, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -409,7 +409,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> CollaborationStateViewBuilder< 'a, collaboration_state_view_state::SetStatus, @@ -426,9 +426,9 @@ where impl<'a, S> CollaborationStateViewBuilder<'a, S> where S: collaboration_state_view_state::State, - S::Participants: collaboration_state_view_state::IsSet, S::Resource: collaboration_state_view_state::IsSet, S::Status: collaboration_state_view_state::IsSet, + S::Participants: collaboration_state_view_state::IsSet, { /// Build the final struct pub fn build(self) -> CollaborationStateView<'a> { @@ -474,6 +474,111 @@ where } } +/// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum CollaborationStateViewStatus<'a> { + Active, + Broken, + Diverged, + Reconciled, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> CollaborationStateViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Active => "active", + Self::Broken => "broken", + Self::Diverged => "diverged", + Self::Reconciled => "reconciled", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for CollaborationStateViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "active" => Self::Active, + "broken" => Self::Broken, + "diverged" => Self::Diverged, + "reconciled" => Self::Reconciled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for CollaborationStateViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "active" => Self::Active, + "broken" => Self::Broken, + "diverged" => Self::Diverged, + "reconciled" => Self::Reconciled, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for CollaborationStateViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for CollaborationStateViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for CollaborationStateViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for CollaborationStateViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for CollaborationStateViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for CollaborationStateViewStatus<'_> { + type Output = CollaborationStateViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + CollaborationStateViewStatus::Active => CollaborationStateViewStatus::Active, + CollaborationStateViewStatus::Broken => CollaborationStateViewStatus::Broken, + CollaborationStateViewStatus::Diverged => { + CollaborationStateViewStatus::Diverged + } + CollaborationStateViewStatus::Reconciled => { + CollaborationStateViewStatus::Reconciled + } + CollaborationStateViewStatus::Other(v) => { + CollaborationStateViewStatus::Other(v.into_static()) + } + } + } +} + fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -483,7 +588,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("chapter"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { @@ -510,7 +615,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "canonicalUri", @@ -736,7 +841,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "contributionCount", @@ -869,7 +974,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptUri", @@ -1097,7 +1202,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptUri", @@ -1314,7 +1419,7 @@ fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -1441,7 +1546,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollaborationStateView<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1481,7 +1586,7 @@ pub struct FormerCollaboratorView<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub contribution_count: std::option::Option, #[serde(borrow)] - pub end_reason: jacquard_common::CowStr<'a>, + pub end_reason: FormerCollaboratorViewEndReason<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub has_published_version: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] @@ -1505,65 +1610,65 @@ pub mod former_collaborator_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EndReason; type WasActiveFrom; type WasActiveUntil; + type EndReason; type User; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EndReason = Unset; type WasActiveFrom = Unset; type WasActiveUntil = Unset; + type EndReason = Unset; type User = Unset; } - ///State transition - sets the `end_reason` field to Set - pub struct SetEndReason(PhantomData S>); - impl sealed::Sealed for SetEndReason {} - impl State for SetEndReason { - type EndReason = Set; - type WasActiveFrom = S::WasActiveFrom; - type WasActiveUntil = S::WasActiveUntil; - type User = S::User; - } ///State transition - sets the `was_active_from` field to Set pub struct SetWasActiveFrom(PhantomData S>); impl sealed::Sealed for SetWasActiveFrom {} impl State for SetWasActiveFrom { - type EndReason = S::EndReason; type WasActiveFrom = Set; type WasActiveUntil = S::WasActiveUntil; + type EndReason = S::EndReason; type User = S::User; } ///State transition - sets the `was_active_until` field to Set pub struct SetWasActiveUntil(PhantomData S>); impl sealed::Sealed for SetWasActiveUntil {} impl State for SetWasActiveUntil { - type EndReason = S::EndReason; type WasActiveFrom = S::WasActiveFrom; type WasActiveUntil = Set; + type EndReason = S::EndReason; + type User = S::User; + } + ///State transition - sets the `end_reason` field to Set + pub struct SetEndReason(PhantomData S>); + impl sealed::Sealed for SetEndReason {} + impl State for SetEndReason { + type WasActiveFrom = S::WasActiveFrom; + type WasActiveUntil = S::WasActiveUntil; + type EndReason = Set; type User = S::User; } ///State transition - sets the `user` field to Set pub struct SetUser(PhantomData S>); impl sealed::Sealed for SetUser {} impl State for SetUser { - type EndReason = S::EndReason; type WasActiveFrom = S::WasActiveFrom; type WasActiveUntil = S::WasActiveUntil; + type EndReason = S::EndReason; type User = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `end_reason` field - pub struct end_reason(()); ///Marker type for the `was_active_from` field pub struct was_active_from(()); ///Marker type for the `was_active_until` field pub struct was_active_until(()); + ///Marker type for the `end_reason` field + pub struct end_reason(()); ///Marker type for the `user` field pub struct user(()); } @@ -1574,7 +1679,7 @@ pub struct FormerCollaboratorViewBuilder<'a, S: former_collaborator_view_state:: _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, @@ -1626,7 +1731,7 @@ where /// Set the `endReason` field (required) pub fn end_reason( mut self, - value: impl Into>, + value: impl Into>, ) -> FormerCollaboratorViewBuilder< 'a, former_collaborator_view_state::SetEndReason, @@ -1738,9 +1843,9 @@ where impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, - S::EndReason: former_collaborator_view_state::IsSet, S::WasActiveFrom: former_collaborator_view_state::IsSet, S::WasActiveUntil: former_collaborator_view_state::IsSet, + S::EndReason: former_collaborator_view_state::IsSet, S::User: former_collaborator_view_state::IsSet, { /// Build the final struct @@ -1777,6 +1882,114 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum FormerCollaboratorViewEndReason<'a> { + VoluntaryLeave, + InviteRevoked, + InviteExpired, + OwnerDeletedResource, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> FormerCollaboratorViewEndReason<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::VoluntaryLeave => "voluntary_leave", + Self::InviteRevoked => "invite_revoked", + Self::InviteExpired => "invite_expired", + Self::OwnerDeletedResource => "owner_deleted_resource", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for FormerCollaboratorViewEndReason<'a> { + fn from(s: &'a str) -> Self { + match s { + "voluntary_leave" => Self::VoluntaryLeave, + "invite_revoked" => Self::InviteRevoked, + "invite_expired" => Self::InviteExpired, + "owner_deleted_resource" => Self::OwnerDeletedResource, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for FormerCollaboratorViewEndReason<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "voluntary_leave" => Self::VoluntaryLeave, + "invite_revoked" => Self::InviteRevoked, + "invite_expired" => Self::InviteExpired, + "owner_deleted_resource" => Self::OwnerDeletedResource, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for FormerCollaboratorViewEndReason<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for FormerCollaboratorViewEndReason<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for FormerCollaboratorViewEndReason<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for FormerCollaboratorViewEndReason<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for FormerCollaboratorViewEndReason<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for FormerCollaboratorViewEndReason<'_> { + type Output = FormerCollaboratorViewEndReason<'static>; + fn into_static(self) -> Self::Output { + match self { + FormerCollaboratorViewEndReason::VoluntaryLeave => { + FormerCollaboratorViewEndReason::VoluntaryLeave + } + FormerCollaboratorViewEndReason::InviteRevoked => { + FormerCollaboratorViewEndReason::InviteRevoked + } + FormerCollaboratorViewEndReason::InviteExpired => { + FormerCollaboratorViewEndReason::InviteExpired + } + FormerCollaboratorViewEndReason::OwnerDeletedResource => { + FormerCollaboratorViewEndReason::OwnerDeletedResource + } + FormerCollaboratorViewEndReason::Other(v) => { + FormerCollaboratorViewEndReason::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FormerCollaboratorView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" @@ -1789,7 +2002,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FormerCollaboratorView<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1831,9 +2044,9 @@ pub struct InviteView<'a> { pub resource_title: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub scope: std::option::Option>, + pub scope: std::option::Option>, #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: InviteViewStatus<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } @@ -1848,127 +2061,127 @@ pub mod invite_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Inviter; type Uri; - type Resource; - type Invitee; + type Inviter; type CreatedAt; type Status; type Cid; + type Resource; + type Invitee; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Inviter = Unset; type Uri = Unset; - type Resource = Unset; - type Invitee = Unset; + type Inviter = Unset; type CreatedAt = Unset; type Status = Unset; type Cid = Unset; - } - ///State transition - sets the `inviter` field to Set - pub struct SetInviter(PhantomData S>); - impl sealed::Sealed for SetInviter {} - impl State for SetInviter { - type Inviter = Set; - type Uri = S::Uri; - type Resource = S::Resource; - type Invitee = S::Invitee; - type CreatedAt = S::CreatedAt; - type Status = S::Status; - type Cid = S::Cid; + type Resource = Unset; + type Invitee = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Inviter = S::Inviter; type Uri = Set; - type Resource = S::Resource; - type Invitee = S::Invitee; - type CreatedAt = S::CreatedAt; - type Status = S::Status; - type Cid = S::Cid; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource(PhantomData S>); - impl sealed::Sealed for SetResource {} - impl State for SetResource { type Inviter = S::Inviter; - type Uri = S::Uri; - type Resource = Set; - type Invitee = S::Invitee; type CreatedAt = S::CreatedAt; type Status = S::Status; type Cid = S::Cid; + type Resource = S::Resource; + type Invitee = S::Invitee; } - ///State transition - sets the `invitee` field to Set - pub struct SetInvitee(PhantomData S>); - impl sealed::Sealed for SetInvitee {} - impl State for SetInvitee { - type Inviter = S::Inviter; + ///State transition - sets the `inviter` field to Set + pub struct SetInviter(PhantomData S>); + impl sealed::Sealed for SetInviter {} + impl State for SetInviter { type Uri = S::Uri; - type Resource = S::Resource; - type Invitee = Set; + type Inviter = Set; type CreatedAt = S::CreatedAt; type Status = S::Status; type Cid = S::Cid; + type Resource = S::Resource; + type Invitee = S::Invitee; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Inviter = S::Inviter; type Uri = S::Uri; - type Resource = S::Resource; - type Invitee = S::Invitee; + type Inviter = S::Inviter; type CreatedAt = Set; type Status = S::Status; type Cid = S::Cid; + type Resource = S::Resource; + type Invitee = S::Invitee; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { - type Inviter = S::Inviter; type Uri = S::Uri; - type Resource = S::Resource; - type Invitee = S::Invitee; + type Inviter = S::Inviter; type CreatedAt = S::CreatedAt; type Status = Set; type Cid = S::Cid; + type Resource = S::Resource; + type Invitee = S::Invitee; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Inviter = S::Inviter; type Uri = S::Uri; + type Inviter = S::Inviter; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + type Cid = Set; type Resource = S::Resource; type Invitee = S::Invitee; + } + ///State transition - sets the `resource` field to Set + pub struct SetResource(PhantomData S>); + impl sealed::Sealed for SetResource {} + impl State for SetResource { + type Uri = S::Uri; + type Inviter = S::Inviter; type CreatedAt = S::CreatedAt; type Status = S::Status; - type Cid = Set; + type Cid = S::Cid; + type Resource = Set; + type Invitee = S::Invitee; + } + ///State transition - sets the `invitee` field to Set + pub struct SetInvitee(PhantomData S>); + impl sealed::Sealed for SetInvitee {} + impl State for SetInvitee { + type Uri = S::Uri; + type Inviter = S::Inviter; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + type Cid = S::Cid; + type Resource = S::Resource; + type Invitee = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `inviter` field - pub struct inviter(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `resource` field - pub struct resource(()); - ///Marker type for the `invitee` field - pub struct invitee(()); + ///Marker type for the `inviter` field + pub struct inviter(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `status` field pub struct status(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `resource` field + pub struct resource(()); + ///Marker type for the `invitee` field + pub struct invitee(()); } } @@ -1986,8 +2199,8 @@ pub struct InviteViewBuilder<'a, S: invite_view_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -2214,15 +2427,12 @@ impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `scope` field (optional) - pub fn scope( - mut self, - value: impl Into>>, - ) -> Self { + pub fn scope(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.10 = value.into(); self } /// Set the `scope` field to an Option value (optional) - pub fn maybe_scope(mut self, value: Option>) -> Self { + pub fn maybe_scope(mut self, value: Option>) -> Self { self.__unsafe_private_named.10 = value; self } @@ -2236,7 +2446,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetStatus> { self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into()); InviteViewBuilder { @@ -2269,13 +2479,13 @@ where impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, - S::Inviter: invite_view_state::IsSet, S::Uri: invite_view_state::IsSet, - S::Resource: invite_view_state::IsSet, - S::Invitee: invite_view_state::IsSet, + S::Inviter: invite_view_state::IsSet, S::CreatedAt: invite_view_state::IsSet, S::Status: invite_view_state::IsSet, S::Cid: invite_view_state::IsSet, + S::Resource: invite_view_state::IsSet, + S::Invitee: invite_view_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteView<'a> { @@ -2323,19 +2533,210 @@ where } } -impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteView<'a> { - fn nsid() -> &'static str { - "sh.weaver.collab.defs" +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum InviteViewScope<'a> { + Notebook, + Entry, + Chapter, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> InviteViewScope<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Notebook => "notebook", + Self::Entry => "entry", + Self::Chapter => "chapter", + Self::Other(s) => s.as_ref(), + } } - fn def_name() -> &'static str { - "inviteView" +} + +impl<'a> From<&'a str> for InviteViewScope<'a> { + fn from(s: &'a str) -> Self { + match s { + "notebook" => Self::Notebook, + "entry" => Self::Entry, + "chapter" => Self::Chapter, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } } - fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { +} + +impl<'a> From for InviteViewScope<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "notebook" => Self::Notebook, + "entry" => Self::Entry, + "chapter" => Self::Chapter, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for InviteViewScope<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for InviteViewScope<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for InviteViewScope<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for InviteViewScope<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for InviteViewScope<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for InviteViewScope<'_> { + type Output = InviteViewScope<'static>; + fn into_static(self) -> Self::Output { + match self { + InviteViewScope::Notebook => InviteViewScope::Notebook, + InviteViewScope::Entry => InviteViewScope::Entry, + InviteViewScope::Chapter => InviteViewScope::Chapter, + InviteViewScope::Other(v) => InviteViewScope::Other(v.into_static()), + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum InviteViewStatus<'a> { + Pending, + Accepted, + Expired, + Revoked, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> InviteViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Pending => "pending", + Self::Accepted => "accepted", + Self::Expired => "expired", + Self::Revoked => "revoked", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for InviteViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "pending" => Self::Pending, + "accepted" => Self::Accepted, + "expired" => Self::Expired, + "revoked" => Self::Revoked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for InviteViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "pending" => Self::Pending, + "accepted" => Self::Accepted, + "expired" => Self::Expired, + "revoked" => Self::Revoked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for InviteViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for InviteViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for InviteViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for InviteViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for InviteViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for InviteViewStatus<'_> { + type Output = InviteViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + InviteViewStatus::Pending => InviteViewStatus::Pending, + InviteViewStatus::Accepted => InviteViewStatus::Accepted, + InviteViewStatus::Expired => InviteViewStatus::Expired, + InviteViewStatus::Revoked => InviteViewStatus::Revoked, + InviteViewStatus::Other(v) => InviteViewStatus::Other(v.into_static()), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteView<'a> { + fn nsid() -> &'static str { + "sh.weaver.collab.defs" + } + fn def_name() -> &'static str { + "inviteView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2378,7 +2779,7 @@ pub struct ParticipantStateView<'a> { /// Why the relationship ended, if applicable #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub end_reason: std::option::Option>, + pub end_reason: std::option::Option>, /// When they first contributed #[serde(skip_serializing_if = "std::option::Option::is_none")] pub first_edit_at: std::option::Option, @@ -2399,10 +2800,10 @@ pub struct ParticipantStateView<'a> { jacquard_common::types::string::Datetime, >, #[serde(borrow)] - pub role: jacquard_common::CowStr<'a>, + pub role: ParticipantStateViewRole<'a>, /// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: ParticipantStateViewStatus<'a>, #[serde(borrow)] pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>, /// True if they ever had active collaboration status @@ -2420,51 +2821,51 @@ pub mod participant_state_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type User; type Role; type Status; - type User; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type User = Unset; type Role = Unset; type Status = Unset; - type User = Unset; + } + ///State transition - sets the `user` field to Set + pub struct SetUser(PhantomData S>); + impl sealed::Sealed for SetUser {} + impl State for SetUser { + type User = Set; + type Role = S::Role; + type Status = S::Status; } ///State transition - sets the `role` field to Set pub struct SetRole(PhantomData S>); impl sealed::Sealed for SetRole {} impl State for SetRole { + type User = S::User; type Role = Set; type Status = S::Status; - type User = S::User; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { - type Role = S::Role; - type Status = Set; type User = S::User; - } - ///State transition - sets the `user` field to Set - pub struct SetUser(PhantomData S>); - impl sealed::Sealed for SetUser {} - impl State for SetUser { type Role = S::Role; - type Status = S::Status; - type User = Set; + type Status = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `user` field + pub struct user(()); ///Marker type for the `role` field pub struct role(()); ///Marker type for the `status` field pub struct status(()); - ///Marker type for the `user` field - pub struct user(()); } } @@ -2473,14 +2874,14 @@ pub struct ParticipantStateViewBuilder<'a, S: participant_state_view_state::Stat _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ), @@ -2543,7 +2944,7 @@ impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, /// Set the `endReason` field (optional) pub fn end_reason( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self @@ -2551,7 +2952,7 @@ impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, /// Set the `endReason` field to an Option value (optional) pub fn maybe_end_reason( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.1 = value; self @@ -2661,7 +3062,7 @@ where /// Set the `role` field (required) pub fn role( mut self, - value: impl Into>, + value: impl Into>, ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetRole> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); ParticipantStateViewBuilder { @@ -2680,7 +3081,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetStatus> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); ParticipantStateViewBuilder { @@ -2726,9 +3127,9 @@ impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, + S::User: participant_state_view_state::IsSet, S::Role: participant_state_view_state::IsSet, S::Status: participant_state_view_state::IsSet, - S::User: participant_state_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ParticipantStateView<'a> { @@ -2772,6 +3173,320 @@ where } } +/// Why the relationship ended, if applicable +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ParticipantStateViewEndReason<'a> { + VoluntaryLeave, + InviteRevoked, + InviteExpired, + OwnerDeletedResource, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ParticipantStateViewEndReason<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::VoluntaryLeave => "voluntary_leave", + Self::InviteRevoked => "invite_revoked", + Self::InviteExpired => "invite_expired", + Self::OwnerDeletedResource => "owner_deleted_resource", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ParticipantStateViewEndReason<'a> { + fn from(s: &'a str) -> Self { + match s { + "voluntary_leave" => Self::VoluntaryLeave, + "invite_revoked" => Self::InviteRevoked, + "invite_expired" => Self::InviteExpired, + "owner_deleted_resource" => Self::OwnerDeletedResource, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ParticipantStateViewEndReason<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "voluntary_leave" => Self::VoluntaryLeave, + "invite_revoked" => Self::InviteRevoked, + "invite_expired" => Self::InviteExpired, + "owner_deleted_resource" => Self::OwnerDeletedResource, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ParticipantStateViewEndReason<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ParticipantStateViewEndReason<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ParticipantStateViewEndReason<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewEndReason<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ParticipantStateViewEndReason<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ParticipantStateViewEndReason<'_> { + type Output = ParticipantStateViewEndReason<'static>; + fn into_static(self) -> Self::Output { + match self { + ParticipantStateViewEndReason::VoluntaryLeave => { + ParticipantStateViewEndReason::VoluntaryLeave + } + ParticipantStateViewEndReason::InviteRevoked => { + ParticipantStateViewEndReason::InviteRevoked + } + ParticipantStateViewEndReason::InviteExpired => { + ParticipantStateViewEndReason::InviteExpired + } + ParticipantStateViewEndReason::OwnerDeletedResource => { + ParticipantStateViewEndReason::OwnerDeletedResource + } + ParticipantStateViewEndReason::Other(v) => { + ParticipantStateViewEndReason::Other(v.into_static()) + } + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ParticipantStateViewRole<'a> { + Owner, + Collaborator, + FormerCollaborator, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ParticipantStateViewRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Owner => "owner", + Self::Collaborator => "collaborator", + Self::FormerCollaborator => "former_collaborator", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ParticipantStateViewRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "owner" => Self::Owner, + "collaborator" => Self::Collaborator, + "former_collaborator" => Self::FormerCollaborator, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ParticipantStateViewRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "owner" => Self::Owner, + "collaborator" => Self::Collaborator, + "former_collaborator" => Self::FormerCollaborator, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ParticipantStateViewRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ParticipantStateViewRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ParticipantStateViewRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ParticipantStateViewRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ParticipantStateViewRole<'_> { + type Output = ParticipantStateViewRole<'static>; + fn into_static(self) -> Self::Output { + match self { + ParticipantStateViewRole::Owner => ParticipantStateViewRole::Owner, + ParticipantStateViewRole::Collaborator => { + ParticipantStateViewRole::Collaborator + } + ParticipantStateViewRole::FormerCollaborator => { + ParticipantStateViewRole::FormerCollaborator + } + ParticipantStateViewRole::Other(v) => { + ParticipantStateViewRole::Other(v.into_static()) + } + } + } +} + +/// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ParticipantStateViewStatus<'a> { + Active, + Invited, + Left, + Removed, + Expired, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ParticipantStateViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Active => "active", + Self::Invited => "invited", + Self::Left => "left", + Self::Removed => "removed", + Self::Expired => "expired", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ParticipantStateViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "active" => Self::Active, + "invited" => Self::Invited, + "left" => Self::Left, + "removed" => Self::Removed, + "expired" => Self::Expired, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ParticipantStateViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "active" => Self::Active, + "invited" => Self::Invited, + "left" => Self::Left, + "removed" => Self::Removed, + "expired" => Self::Expired, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ParticipantStateViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ParticipantStateViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ParticipantStateViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ParticipantStateViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ParticipantStateViewStatus<'_> { + type Output = ParticipantStateViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + ParticipantStateViewStatus::Active => ParticipantStateViewStatus::Active, + ParticipantStateViewStatus::Invited => ParticipantStateViewStatus::Invited, + ParticipantStateViewStatus::Left => ParticipantStateViewStatus::Left, + ParticipantStateViewStatus::Removed => ParticipantStateViewStatus::Removed, + ParticipantStateViewStatus::Expired => ParticipantStateViewStatus::Expired, + ParticipantStateViewStatus::Other(v) => { + ParticipantStateViewStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ParticipantStateView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" @@ -2784,7 +3499,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ParticipantStateView<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2828,85 +3543,85 @@ pub mod session_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Resource; type User; - type NodeId; type CreatedAt; + type NodeId; + type Resource; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Resource = Unset; type User = Unset; - type NodeId = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Resource = S::Resource; - type User = S::User; - type NodeId = S::NodeId; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource(PhantomData S>); - impl sealed::Sealed for SetResource {} - impl State for SetResource { - type Uri = S::Uri; - type Resource = Set; - type User = S::User; - type NodeId = S::NodeId; - type CreatedAt = S::CreatedAt; + type NodeId = Unset; + type Resource = Unset; + type Uri = Unset; } ///State transition - sets the `user` field to Set pub struct SetUser(PhantomData S>); impl sealed::Sealed for SetUser {} impl State for SetUser { - type Uri = S::Uri; - type Resource = S::Resource; type User = Set; - type NodeId = S::NodeId; type CreatedAt = S::CreatedAt; + type NodeId = S::NodeId; + type Resource = S::Resource; + type Uri = S::Uri; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type User = S::User; + type CreatedAt = Set; + type NodeId = S::NodeId; + type Resource = S::Resource; + type Uri = S::Uri; } ///State transition - sets the `node_id` field to Set pub struct SetNodeId(PhantomData S>); impl sealed::Sealed for SetNodeId {} impl State for SetNodeId { - type Uri = S::Uri; - type Resource = S::Resource; type User = S::User; - type NodeId = Set; type CreatedAt = S::CreatedAt; + type NodeId = Set; + type Resource = S::Resource; + type Uri = S::Uri; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { + ///State transition - sets the `resource` field to Set + pub struct SetResource(PhantomData S>); + impl sealed::Sealed for SetResource {} + impl State for SetResource { + type User = S::User; + type CreatedAt = S::CreatedAt; + type NodeId = S::NodeId; + type Resource = Set; type Uri = S::Uri; - type Resource = S::Resource; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { type User = S::User; + type CreatedAt = S::CreatedAt; type NodeId = S::NodeId; - type CreatedAt = Set; + type Resource = S::Resource; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `resource` field - pub struct resource(()); ///Marker type for the `user` field pub struct user(()); - ///Marker type for the `node_id` field - pub struct node_id(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `node_id` field + pub struct node_id(()); + ///Marker type for the `resource` field + pub struct resource(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -3079,11 +3794,11 @@ where impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, - S::Uri: session_view_state::IsSet, - S::Resource: session_view_state::IsSet, S::User: session_view_state::IsSet, - S::NodeId: session_view_state::IsSet, S::CreatedAt: session_view_state::IsSet, + S::NodeId: session_view_state::IsSet, + S::Resource: session_view_state::IsSet, + S::Uri: session_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SessionView<'a> { @@ -3131,7 +3846,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SessionView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/collab/accept.rs b/crates/weaver-api/src/sh_weaver/collab/accept.rs index e3b0e42..34260eb 100644 --- a/crates/weaver-api/src/sh_weaver/collab/accept.rs +++ b/crates/weaver-api/src/sh_weaver/collab/accept.rs @@ -38,50 +38,50 @@ pub mod accept_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Resource; - type Invite; type CreatedAt; + type Invite; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Resource = Unset; - type Invite = Unset; type CreatedAt = Unset; + type Invite = Unset; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { type Resource = Set; - type Invite = S::Invite; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `invite` field to Set - pub struct SetInvite(PhantomData S>); - impl sealed::Sealed for SetInvite {} - impl State for SetInvite { - type Resource = S::Resource; - type Invite = Set; type CreatedAt = S::CreatedAt; + type Invite = S::Invite; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Resource = S::Resource; - type Invite = S::Invite; type CreatedAt = Set; + type Invite = S::Invite; + } + ///State transition - sets the `invite` field to Set + pub struct SetInvite(PhantomData S>); + impl sealed::Sealed for SetInvite {} + impl State for SetInvite { + type Resource = S::Resource; + type CreatedAt = S::CreatedAt; + type Invite = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `resource` field pub struct resource(()); - ///Marker type for the `invite` field - pub struct invite(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `invite` field + pub struct invite(()); } } @@ -175,8 +175,8 @@ impl<'a, S> AcceptBuilder<'a, S> where S: accept_state::State, S::Resource: accept_state::IsSet, - S::Invite: accept_state::IsSet, S::CreatedAt: accept_state::IsSet, + S::Invite: accept_state::IsSet, { /// Build the final struct pub fn build(self) -> Accept<'a> { @@ -277,7 +277,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Accept<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -291,7 +291,7 @@ fn lexicon_doc_sh_weaver_collab_accept() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -313,7 +313,7 @@ fn lexicon_doc_sh_weaver_collab_accept() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/collab/invite.rs b/crates/weaver-api/src/sh_weaver/collab/invite.rs index 9f749ee..087eb79 100644 --- a/crates/weaver-api/src/sh_weaver/collab/invite.rs +++ b/crates/weaver-api/src/sh_weaver/collab/invite.rs @@ -53,6 +53,12 @@ impl<'a> AsRef for CollabScope<'a> { } } +impl<'a> core::fmt::Display for CollabScope<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for CollabScope<'a> { fn serialize(&self, serializer: S) -> Result where @@ -437,7 +443,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Invite<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.message { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -481,7 +487,7 @@ fn lexicon_doc_sh_weaver_collab_invite() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("collabScope"), ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { @@ -522,7 +528,7 @@ fn lexicon_doc_sh_weaver_collab_invite() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/collab/session.rs b/crates/weaver-api/src/sh_weaver/collab/session.rs index f1b894d..c0ffe28 100644 --- a/crates/weaver-api/src/sh_weaver/collab/session.rs +++ b/crates/weaver-api/src/sh_weaver/collab/session.rs @@ -44,51 +44,51 @@ pub mod session_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type NodeId; type CreatedAt; type Resource; - type NodeId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type NodeId = Unset; type CreatedAt = Unset; type Resource = Unset; - type NodeId = Unset; + } + ///State transition - sets the `node_id` field to Set + pub struct SetNodeId(PhantomData S>); + impl sealed::Sealed for SetNodeId {} + impl State for SetNodeId { + type NodeId = Set; + type CreatedAt = S::CreatedAt; + type Resource = S::Resource; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { + type NodeId = S::NodeId; type CreatedAt = Set; type Resource = S::Resource; - type NodeId = S::NodeId; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { - type CreatedAt = S::CreatedAt; - type Resource = Set; type NodeId = S::NodeId; - } - ///State transition - sets the `node_id` field to Set - pub struct SetNodeId(PhantomData S>); - impl sealed::Sealed for SetNodeId {} - impl State for SetNodeId { type CreatedAt = S::CreatedAt; - type Resource = S::Resource; - type NodeId = Set; + type Resource = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `node_id` field + pub struct node_id(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `resource` field pub struct resource(()); - ///Marker type for the `node_id` field - pub struct node_id(()); } } @@ -221,9 +221,9 @@ where impl<'a, S> SessionBuilder<'a, S> where S: session_state::State, + S::NodeId: session_state::IsSet, S::CreatedAt: session_state::IsSet, S::Resource: session_state::IsSet, - S::NodeId: session_state::IsSet, { /// Build the final struct pub fn build(self) -> Session<'a> { @@ -328,7 +328,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Session<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -342,7 +342,7 @@ fn lexicon_doc_sh_weaver_collab_session() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -364,7 +364,7 @@ fn lexicon_doc_sh_weaver_collab_session() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/edit.rs b/crates/weaver-api/src/sh_weaver/edit.rs index 4ab93ac..784cedb 100644 --- a/crates/weaver-api/src/sh_weaver/edit.rs +++ b/crates/weaver-api/src/sh_weaver/edit.rs @@ -164,7 +164,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("docRef"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -175,7 +175,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -204,7 +204,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("draftKey"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -243,7 +243,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -344,7 +344,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -490,7 +490,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("branches"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -569,7 +569,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -595,7 +595,7 @@ fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notebook"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -626,7 +626,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DocRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -660,7 +660,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DraftRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.draft_key; #[allow(unused_comparisons)] @@ -721,67 +721,67 @@ pub mod edit_branch_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type LastUpdated; type Length; type Author; type Head; + type LastUpdated; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type LastUpdated = Unset; type Length = Unset; type Author = Unset; type Head = Unset; - } - ///State transition - sets the `last_updated` field to Set - pub struct SetLastUpdated(PhantomData S>); - impl sealed::Sealed for SetLastUpdated {} - impl State for SetLastUpdated { - type LastUpdated = Set; - type Length = S::Length; - type Author = S::Author; - type Head = S::Head; + type LastUpdated = Unset; } ///State transition - sets the `length` field to Set pub struct SetLength(PhantomData S>); impl sealed::Sealed for SetLength {} impl State for SetLength { - type LastUpdated = S::LastUpdated; type Length = Set; type Author = S::Author; type Head = S::Head; + type LastUpdated = S::LastUpdated; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type LastUpdated = S::LastUpdated; type Length = S::Length; type Author = Set; type Head = S::Head; + type LastUpdated = S::LastUpdated; } ///State transition - sets the `head` field to Set pub struct SetHead(PhantomData S>); impl sealed::Sealed for SetHead {} impl State for SetHead { - type LastUpdated = S::LastUpdated; type Length = S::Length; type Author = S::Author; type Head = Set; + type LastUpdated = S::LastUpdated; + } + ///State transition - sets the `last_updated` field to Set + pub struct SetLastUpdated(PhantomData S>); + impl sealed::Sealed for SetLastUpdated {} + impl State for SetLastUpdated { + type Length = S::Length; + type Author = S::Author; + type Head = S::Head; + type LastUpdated = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `last_updated` field - pub struct last_updated(()); ///Marker type for the `length` field pub struct length(()); ///Marker type for the `author` field pub struct author(()); ///Marker type for the `head` field pub struct head(()); + ///Marker type for the `last_updated` field + pub struct last_updated(()); } } @@ -948,10 +948,10 @@ impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> { impl<'a, S> EditBranchViewBuilder<'a, S> where S: edit_branch_view_state::State, - S::LastUpdated: edit_branch_view_state::IsSet, S::Length: edit_branch_view_state::IsSet, S::Author: edit_branch_view_state::IsSet, S::Head: edit_branch_view_state::IsSet, + S::LastUpdated: edit_branch_view_state::IsSet, { /// Build the final struct pub fn build(self) -> EditBranchView<'a> { @@ -999,7 +999,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditBranchView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1038,7 +1038,7 @@ pub struct EditHistoryEntry<'a> { #[serde(borrow)] pub snapshot_cid: std::option::Option>, #[serde(borrow)] - pub r#type: jacquard_common::CowStr<'a>, + pub r#type: EditHistoryEntryType<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } @@ -1053,85 +1053,85 @@ pub mod edit_history_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; + type Uri; + type Cid; type Author; + type CreatedAt; type Type; - type Cid; - type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; + type Uri = Unset; + type Cid = Unset; type Author = Unset; + type CreatedAt = Unset; type Type = Unset; - type Cid = Unset; - type Uri = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Uri = Set; + type Cid = S::Cid; type Author = S::Author; + type CreatedAt = S::CreatedAt; type Type = S::Type; - type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { type Uri = S::Uri; + type Cid = Set; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Type = S::Type; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; type Author = Set; + type CreatedAt = S::CreatedAt; type Type = S::Type; - type Cid = S::Cid; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { type Uri = S::Uri; + type Cid = S::Cid; + type Author = S::Author; + type CreatedAt = Set; + type Type = S::Type; } ///State transition - sets the `type` field to Set pub struct SetType(PhantomData S>); impl sealed::Sealed for SetType {} impl State for SetType { - type CreatedAt = S::CreatedAt; - type Author = S::Author; - type Type = Set; - type Cid = S::Cid; type Uri = S::Uri; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type CreatedAt = S::CreatedAt; + type Cid = S::Cid; type Author = S::Author; - type Type = S::Type; - type Cid = Set; - type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { type CreatedAt = S::CreatedAt; - type Author = S::Author; - type Type = S::Type; - type Cid = S::Cid; - type Uri = Set; + type Type = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `type` field pub struct r#type(()); - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); } } @@ -1146,7 +1146,7 @@ pub struct EditHistoryEntryBuilder<'a, S: edit_history_entry_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -1315,7 +1315,7 @@ where /// Set the `type` field (required) pub fn r#type( mut self, - value: impl Into>, + value: impl Into>, ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetType> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); EditHistoryEntryBuilder { @@ -1348,11 +1348,11 @@ where impl<'a, S> EditHistoryEntryBuilder<'a, S> where S: edit_history_entry_state::State, - S::CreatedAt: edit_history_entry_state::IsSet, + S::Uri: edit_history_entry_state::IsSet, + S::Cid: edit_history_entry_state::IsSet, S::Author: edit_history_entry_state::IsSet, + S::CreatedAt: edit_history_entry_state::IsSet, S::Type: edit_history_entry_state::IsSet, - S::Cid: edit_history_entry_state::IsSet, - S::Uri: edit_history_entry_state::IsSet, { /// Build the final struct pub fn build(self) -> EditHistoryEntry<'a> { @@ -1392,6 +1392,96 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum EditHistoryEntryType<'a> { + Root, + Diff, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> EditHistoryEntryType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Root => "root", + Self::Diff => "diff", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for EditHistoryEntryType<'a> { + fn from(s: &'a str) -> Self { + match s { + "root" => Self::Root, + "diff" => Self::Diff, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for EditHistoryEntryType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "root" => Self::Root, + "diff" => Self::Diff, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for EditHistoryEntryType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for EditHistoryEntryType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for EditHistoryEntryType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for EditHistoryEntryType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for EditHistoryEntryType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for EditHistoryEntryType<'_> { + type Output = EditHistoryEntryType<'static>; + fn into_static(self) -> Self::Output { + match self { + EditHistoryEntryType::Root => EditHistoryEntryType::Root, + EditHistoryEntryType::Diff => EditHistoryEntryType::Diff, + EditHistoryEntryType::Other(v) => { + EditHistoryEntryType::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditHistoryEntry<'a> { fn nsid() -> &'static str { "sh.weaver.edit.defs" @@ -1404,7 +1494,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditHistoryEntry<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1653,7 +1743,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditTreeView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1791,7 +1881,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EntryRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1929,7 +2019,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotebookRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/edit/cursor.rs b/crates/weaver-api/src/sh_weaver/edit/cursor.rs index 308918e..aaa0b8a 100644 --- a/crates/weaver-api/src/sh_weaver/edit/cursor.rs +++ b/crates/weaver-api/src/sh_weaver/edit/cursor.rs @@ -152,7 +152,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("containerId"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -163,7 +163,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -189,7 +189,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -218,7 +218,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("counter"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -265,7 +265,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container", @@ -308,7 +308,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container_type", @@ -365,7 +365,7 @@ fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container_type", @@ -419,7 +419,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContainerId<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -555,7 +555,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CursorSide<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -722,7 +722,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -984,7 +984,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Cursor<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1017,51 +1017,51 @@ pub mod normal_container_id_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Counter; type Peer; type ContainerType; - type Counter; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Counter = Unset; type Peer = Unset; type ContainerType = Unset; - type Counter = Unset; + } + ///State transition - sets the `counter` field to Set + pub struct SetCounter(PhantomData S>); + impl sealed::Sealed for SetCounter {} + impl State for SetCounter { + type Counter = Set; + type Peer = S::Peer; + type ContainerType = S::ContainerType; } ///State transition - sets the `peer` field to Set pub struct SetPeer(PhantomData S>); impl sealed::Sealed for SetPeer {} impl State for SetPeer { + type Counter = S::Counter; type Peer = Set; type ContainerType = S::ContainerType; - type Counter = S::Counter; } ///State transition - sets the `container_type` field to Set pub struct SetContainerType(PhantomData S>); impl sealed::Sealed for SetContainerType {} impl State for SetContainerType { - type Peer = S::Peer; - type ContainerType = Set; type Counter = S::Counter; - } - ///State transition - sets the `counter` field to Set - pub struct SetCounter(PhantomData S>); - impl sealed::Sealed for SetCounter {} - impl State for SetCounter { type Peer = S::Peer; - type ContainerType = S::ContainerType; - type Counter = Set; + type ContainerType = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `counter` field + pub struct counter(()); ///Marker type for the `peer` field pub struct peer(()); ///Marker type for the `container_type` field pub struct container_type(()); - ///Marker type for the `counter` field - pub struct counter(()); } } @@ -1154,9 +1154,9 @@ where impl<'a, S> NormalContainerIdBuilder<'a, S> where S: normal_container_id_state::State, + S::Counter: normal_container_id_state::IsSet, S::Peer: normal_container_id_state::IsSet, S::ContainerType: normal_container_id_state::IsSet, - S::Counter: normal_container_id_state::IsSet, { /// Build the final struct pub fn build(self) -> NormalContainerId<'a> { @@ -1196,7 +1196,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NormalContainerId<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1232,7 +1232,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RootContainerId<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/edit/diff.rs b/crates/weaver-api/src/sh_weaver/edit/diff.rs index 52a4bdb..062858f 100644 --- a/crates/weaver-api/src/sh_weaver/edit/diff.rs +++ b/crates/weaver-api/src/sh_weaver/edit/diff.rs @@ -332,7 +332,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Diff<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -346,7 +346,7 @@ fn lexicon_doc_sh_weaver_edit_diff() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -367,7 +367,7 @@ fn lexicon_doc_sh_weaver_edit_diff() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/edit/draft.rs b/crates/weaver-api/src/sh_weaver/edit/draft.rs index 4435685..a7048d1 100644 --- a/crates/weaver-api/src/sh_weaver/edit/draft.rs +++ b/crates/weaver-api/src/sh_weaver/edit/draft.rs @@ -199,7 +199,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Draft<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -213,7 +213,7 @@ fn lexicon_doc_sh_weaver_edit_draft() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -233,7 +233,7 @@ fn lexicon_doc_sh_weaver_edit_draft() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/edit/list_drafts.rs b/crates/weaver-api/src/sh_weaver/edit/list_drafts.rs index 817f0f0..d679e1a 100644 --- a/crates/weaver-api/src/sh_weaver/edit/list_drafts.rs +++ b/crates/weaver-api/src/sh_weaver/edit/list_drafts.rs @@ -286,7 +286,7 @@ fn lexicon_doc_sh_weaver_edit_listDrafts() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("draftView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -305,7 +305,7 @@ fn lexicon_doc_sh_weaver_edit_listDrafts() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -424,7 +424,7 @@ fn lexicon_doc_sh_weaver_edit_listDrafts() -> ::jacquard_lexicon::lexicon::Lexic ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -497,7 +497,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DraftView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/sh_weaver/edit/root.rs b/crates/weaver-api/src/sh_weaver/edit/root.rs index b53c569..563af17 100644 --- a/crates/weaver-api/src/sh_weaver/edit/root.rs +++ b/crates/weaver-api/src/sh_weaver/edit/root.rs @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Root<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_edit_root() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_edit_root() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("doc"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { diff --git a/crates/weaver-api/src/sh_weaver/embed.rs b/crates/weaver-api/src/sh_weaver/embed.rs index f1389d2..7c9dccc 100644 --- a/crates/weaver-api/src/sh_weaver/embed.rs +++ b/crates/weaver-api/src/sh_weaver/embed.rs @@ -38,37 +38,37 @@ pub mod percent_size_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Height; type Width; + type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Height = Unset; type Width = Unset; - } - ///State transition - sets the `height` field to Set - pub struct SetHeight(PhantomData S>); - impl sealed::Sealed for SetHeight {} - impl State for SetHeight { - type Height = Set; - type Width = S::Width; + type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth(PhantomData S>); impl sealed::Sealed for SetWidth {} impl State for SetWidth { - type Height = S::Height; type Width = Set; + type Height = S::Height; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight(PhantomData S>); + impl sealed::Sealed for SetHeight {} + impl State for SetHeight { + type Width = S::Width; + type Height = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `height` field - pub struct height(()); ///Marker type for the `width` field pub struct width(()); + ///Marker type for the `height` field + pub struct height(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> PercentSizeBuilder<'a, S> where S: percent_size_state::State, - S::Height: percent_size_state::IsSet, S::Width: percent_size_state::IsSet, + S::Height: percent_size_state::IsSet, { /// Build the final struct pub fn build(self) -> PercentSize<'a> { @@ -174,7 +174,7 @@ fn lexicon_doc_sh_weaver_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("percentSize"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -192,7 +192,7 @@ fn lexicon_doc_sh_weaver_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -236,7 +236,7 @@ fn lexicon_doc_sh_weaver_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -280,7 +280,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PercentSize<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -451,7 +451,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PixelSize<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/embed/external.rs b/crates/weaver-api/src/sh_weaver/embed/external.rs index a96cf3b..7f6ef3b 100644 --- a/crates/weaver-api/src/sh_weaver/embed/external.rs +++ b/crates/weaver-api/src/sh_weaver/embed/external.rs @@ -236,7 +236,7 @@ fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("externalEmbed"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -323,7 +323,7 @@ fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("embeds"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -354,7 +354,7 @@ fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("external"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -387,7 +387,7 @@ fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -475,7 +475,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ExternalEmbed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -615,7 +615,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for External<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.embeds; #[allow(unused_comparisons)] @@ -766,7 +766,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.external; #[allow(unused_comparisons)] @@ -817,51 +817,51 @@ pub mod view_external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Title; type Description; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Title = Unset; type Description = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Title = S::Title; - type Description = S::Description; + type Uri = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { - type Uri = S::Uri; type Title = Set; type Description = S::Description; + type Uri = S::Uri; } ///State transition - sets the `description` field to Set pub struct SetDescription(PhantomData S>); impl sealed::Sealed for SetDescription {} impl State for SetDescription { - type Uri = S::Uri; type Title = S::Title; type Description = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Title = S::Title; + type Description = S::Description; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `description` field pub struct description(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -974,9 +974,9 @@ where impl<'a, S> ViewExternalBuilder<'a, S> where S: view_external_state::State, - S::Uri: view_external_state::IsSet, S::Title: view_external_state::IsSet, S::Description: view_external_state::IsSet, + S::Uri: view_external_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewExternal<'a> { @@ -1018,7 +1018,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewExternal<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/embed/images.rs b/crates/weaver-api/src/sh_weaver/embed/images.rs index 659bde4..5ef0d9a 100644 --- a/crates/weaver-api/src/sh_weaver/embed/images.rs +++ b/crates/weaver-api/src/sh_weaver/embed/images.rs @@ -258,7 +258,7 @@ fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -362,7 +362,7 @@ fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -389,7 +389,7 @@ fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -420,7 +420,7 @@ fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -532,7 +532,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.blurhash { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 32usize { @@ -694,7 +694,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Images<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] @@ -845,7 +845,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] @@ -902,49 +902,49 @@ pub mod view_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Fullsize; type Thumb; + type Fullsize; type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Fullsize = Unset; type Thumb = Unset; + type Fullsize = Unset; type Alt = Unset; } - ///State transition - sets the `fullsize` field to Set - pub struct SetFullsize(PhantomData S>); - impl sealed::Sealed for SetFullsize {} - impl State for SetFullsize { - type Fullsize = Set; - type Thumb = S::Thumb; - type Alt = S::Alt; - } ///State transition - sets the `thumb` field to Set pub struct SetThumb(PhantomData S>); impl sealed::Sealed for SetThumb {} impl State for SetThumb { - type Fullsize = S::Fullsize; type Thumb = Set; + type Fullsize = S::Fullsize; + type Alt = S::Alt; + } + ///State transition - sets the `fullsize` field to Set + pub struct SetFullsize(PhantomData S>); + impl sealed::Sealed for SetFullsize {} + impl State for SetFullsize { + type Thumb = S::Thumb; + type Fullsize = Set; type Alt = S::Alt; } ///State transition - sets the `alt` field to Set pub struct SetAlt(PhantomData S>); impl sealed::Sealed for SetAlt {} impl State for SetAlt { - type Fullsize = S::Fullsize; type Thumb = S::Thumb; + type Fullsize = S::Fullsize; type Alt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `fullsize` field - pub struct fullsize(()); ///Marker type for the `thumb` field pub struct thumb(()); + ///Marker type for the `fullsize` field + pub struct fullsize(()); ///Marker type for the `alt` field pub struct alt(()); } @@ -1073,8 +1073,8 @@ where impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, - S::Fullsize: view_image_state::IsSet, S::Thumb: view_image_state::IsSet, + S::Fullsize: view_image_state::IsSet, S::Alt: view_image_state::IsSet, { /// Build the final struct @@ -1140,7 +1140,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewImage<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 128usize { diff --git a/crates/weaver-api/src/sh_weaver/embed/record_with_media.rs b/crates/weaver-api/src/sh_weaver/embed/record_with_media.rs index a286344..a622740 100644 --- a/crates/weaver-api/src/sh_weaver/embed/record_with_media.rs +++ b/crates/weaver-api/src/sh_weaver/embed/record_with_media.rs @@ -193,7 +193,7 @@ fn lexicon_doc_sh_weaver_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -207,7 +207,7 @@ fn lexicon_doc_sh_weaver_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("media"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -246,7 +246,7 @@ fn lexicon_doc_sh_weaver_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("media"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -289,7 +289,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordWithMedia<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -323,37 +323,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Media; type Record; + type Media; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Media = Unset; type Record = Unset; - } - ///State transition - sets the `media` field to Set - pub struct SetMedia(PhantomData S>); - impl sealed::Sealed for SetMedia {} - impl State for SetMedia { - type Media = Set; - type Record = S::Record; + type Media = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Media = S::Media; type Record = Set; + type Media = S::Media; + } + ///State transition - sets the `media` field to Set + pub struct SetMedia(PhantomData S>); + impl sealed::Sealed for SetMedia {} + impl State for SetMedia { + type Record = S::Record; + type Media = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `media` field - pub struct media(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `media` field + pub struct media(()); } } @@ -426,8 +426,8 @@ impl<'a, S: view_state::State> ViewBuilder<'a, S> { impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Media: view_state::IsSet, S::Record: view_state::IsSet, + S::Media: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { @@ -486,7 +486,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/embed/records.rs b/crates/weaver-api/src/sh_weaver/embed/records.rs index fda8e47..dc3df86 100644 --- a/crates/weaver-api/src/sh_weaver/embed/records.rs +++ b/crates/weaver-api/src/sh_weaver/embed/records.rs @@ -135,7 +135,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -146,7 +146,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("records"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -173,7 +173,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -214,7 +214,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -259,7 +259,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -295,7 +295,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -347,7 +347,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("detached"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -390,7 +390,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notFound"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -436,7 +436,7 @@ fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -606,7 +606,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Records<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.records; #[allow(unused_comparisons)] @@ -779,7 +779,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEmbed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 128usize { @@ -974,7 +974,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEmbedView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 128usize { @@ -1153,7 +1153,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1187,51 +1187,51 @@ pub mod view_blocked_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Blocked; type Author; + type Blocked; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Blocked = Unset; type Author = Unset; + type Blocked = Unset; + type Uri = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; + ///State transition - sets the `author` field to Set + pub struct SetAuthor(PhantomData S>); + impl sealed::Sealed for SetAuthor {} + impl State for SetAuthor { + type Author = Set; type Blocked = S::Blocked; - type Author = S::Author; + type Uri = S::Uri; } ///State transition - sets the `blocked` field to Set pub struct SetBlocked(PhantomData S>); impl sealed::Sealed for SetBlocked {} impl State for SetBlocked { - type Uri = S::Uri; - type Blocked = Set; type Author = S::Author; - } - ///State transition - sets the `author` field to Set - pub struct SetAuthor(PhantomData S>); - impl sealed::Sealed for SetAuthor {} - impl State for SetAuthor { + type Blocked = Set; type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Author = S::Author; type Blocked = S::Blocked; - type Author = Set; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `blocked` field - pub struct blocked(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `blocked` field + pub struct blocked(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -1324,9 +1324,9 @@ where impl<'a, S> ViewBlockedBuilder<'a, S> where S: view_blocked_state::State, - S::Uri: view_blocked_state::IsSet, - S::Blocked: view_blocked_state::IsSet, S::Author: view_blocked_state::IsSet, + S::Blocked: view_blocked_state::IsSet, + S::Uri: view_blocked_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewBlocked<'a> { @@ -1366,7 +1366,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewBlocked<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1398,37 +1398,37 @@ pub mod view_detached_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Detached; type Uri; + type Detached; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Detached = Unset; type Uri = Unset; - } - ///State transition - sets the `detached` field to Set - pub struct SetDetached(PhantomData S>); - impl sealed::Sealed for SetDetached {} - impl State for SetDetached { - type Detached = Set; - type Uri = S::Uri; + type Detached = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Detached = S::Detached; type Uri = Set; + type Detached = S::Detached; + } + ///State transition - sets the `detached` field to Set + pub struct SetDetached(PhantomData S>); + impl sealed::Sealed for SetDetached {} + impl State for SetDetached { + type Uri = S::Uri; + type Detached = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `detached` field - pub struct detached(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `detached` field + pub struct detached(()); } } @@ -1501,8 +1501,8 @@ where impl<'a, S> ViewDetachedBuilder<'a, S> where S: view_detached_state::State, - S::Detached: view_detached_state::IsSet, S::Uri: view_detached_state::IsSet, + S::Detached: view_detached_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewDetached<'a> { @@ -1540,7 +1540,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewDetached<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1714,7 +1714,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewNotFound<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1769,8 +1769,8 @@ pub mod view_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Value; type Cid; + type Value; type IndexedAt; type Uri; type Author; @@ -1779,28 +1779,28 @@ pub mod view_record_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Value = Unset; type Cid = Unset; + type Value = Unset; type IndexedAt = Unset; type Uri = Unset; type Author = Unset; } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { - type Value = Set; - type Cid = S::Cid; - type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Author = S::Author; - } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Value = S::Value; type Cid = Set; + type Value = S::Value; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Author = S::Author; + } + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Cid = S::Cid; + type Value = Set; type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Author = S::Author; @@ -1809,8 +1809,8 @@ pub mod view_record_state { pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Value = S::Value; type Cid = S::Cid; + type Value = S::Value; type IndexedAt = Set; type Uri = S::Uri; type Author = S::Author; @@ -1819,8 +1819,8 @@ pub mod view_record_state { pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Value = S::Value; type Cid = S::Cid; + type Value = S::Value; type IndexedAt = S::IndexedAt; type Uri = Set; type Author = S::Author; @@ -1829,8 +1829,8 @@ pub mod view_record_state { pub struct SetAuthor(PhantomData S>); impl sealed::Sealed for SetAuthor {} impl State for SetAuthor { - type Value = S::Value; type Cid = S::Cid; + type Value = S::Value; type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Author = Set; @@ -1838,10 +1838,10 @@ pub mod view_record_state { /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `value` field + pub struct value(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `uri` field @@ -2092,8 +2092,8 @@ where impl<'a, S> ViewRecordBuilder<'a, S> where S: view_record_state::State, - S::Value: view_record_state::IsSet, S::Cid: view_record_state::IsSet, + S::Value: view_record_state::IsSet, S::IndexedAt: view_record_state::IsSet, S::Uri: view_record_state::IsSet, S::Author: view_record_state::IsSet, @@ -2152,7 +2152,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewRecord<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/embed/video.rs b/crates/weaver-api/src/sh_weaver/embed/video.rs index c4629c2..ca20c77 100644 --- a/crates/weaver-api/src/sh_weaver/embed/video.rs +++ b/crates/weaver-api/src/sh_weaver/embed/video.rs @@ -171,7 +171,7 @@ fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("caption"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -185,7 +185,7 @@ fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("file"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -225,7 +225,7 @@ fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("videos"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -252,7 +252,7 @@ fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -338,7 +338,7 @@ fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -457,7 +457,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Caption<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -595,7 +595,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VideoRecord<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -841,7 +841,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Video<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.alt { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10000usize { @@ -1176,7 +1176,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.alt { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10000usize { diff --git a/crates/weaver-api/src/sh_weaver/graph.rs b/crates/weaver-api/src/sh_weaver/graph.rs index b42a441..34ef11f 100644 --- a/crates/weaver-api/src/sh_weaver/graph.rs +++ b/crates/weaver-api/src/sh_weaver/graph.rs @@ -198,7 +198,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("communityTagCount"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -216,7 +216,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("count"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -270,7 +270,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("addedAt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -355,7 +355,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -534,7 +534,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "authorTags", @@ -645,7 +645,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "appliedBy", @@ -729,7 +729,7 @@ fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "entryCount", @@ -829,7 +829,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CommunityTagCount<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -883,37 +883,37 @@ pub mod list_item_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type Uri; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type Uri = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject(PhantomData S>); - impl sealed::Sealed for SetSubject {} - impl State for SetSubject { - type Subject = Set; - type Uri = S::Uri; + type Subject = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Subject = S::Subject; type Uri = Set; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type Uri = S::Uri; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -1006,8 +1006,8 @@ where impl<'a, S> ListItemViewBuilder<'a, S> where S: list_item_view_state::State, - S::Subject: list_item_view_state::IsSet, S::Uri: list_item_view_state::IsSet, + S::Subject: list_item_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListItemView<'a> { @@ -1066,7 +1066,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItemView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1118,6 +1118,12 @@ impl<'a> AsRef for ListPurpose<'a> { } } +impl<'a> core::fmt::Display for ListPurpose<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ListPurpose<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1206,127 +1212,127 @@ pub mod list_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Purpose; type Uri; - type ItemCount; type Name; + type ItemCount; + type Cid; + type Purpose; type IndexedAt; type Creator; - type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Purpose = Unset; type Uri = Unset; - type ItemCount = Unset; type Name = Unset; + type ItemCount = Unset; + type Cid = Unset; + type Purpose = Unset; type IndexedAt = Unset; type Creator = Unset; - type Cid = Unset; - } - ///State transition - sets the `purpose` field to Set - pub struct SetPurpose(PhantomData S>); - impl sealed::Sealed for SetPurpose {} - impl State for SetPurpose { - type Purpose = Set; - type Uri = S::Uri; - type ItemCount = S::ItemCount; - type Name = S::Name; - type IndexedAt = S::IndexedAt; - type Creator = S::Creator; - type Cid = S::Cid; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Purpose = S::Purpose; type Uri = Set; - type ItemCount = S::ItemCount; type Name = S::Name; + type ItemCount = S::ItemCount; + type Cid = S::Cid; + type Purpose = S::Purpose; type IndexedAt = S::IndexedAt; type Creator = S::Creator; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Uri = S::Uri; + type Name = Set; + type ItemCount = S::ItemCount; type Cid = S::Cid; + type Purpose = S::Purpose; + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; } ///State transition - sets the `item_count` field to Set pub struct SetItemCount(PhantomData S>); impl sealed::Sealed for SetItemCount {} impl State for SetItemCount { - type Purpose = S::Purpose; type Uri = S::Uri; - type ItemCount = Set; type Name = S::Name; + type ItemCount = Set; + type Cid = S::Cid; + type Purpose = S::Purpose; type IndexedAt = S::IndexedAt; type Creator = S::Creator; - type Cid = S::Cid; } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Purpose = S::Purpose; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { type Uri = S::Uri; + type Name = S::Name; type ItemCount = S::ItemCount; - type Name = Set; + type Cid = Set; + type Purpose = S::Purpose; type IndexedAt = S::IndexedAt; type Creator = S::Creator; + } + ///State transition - sets the `purpose` field to Set + pub struct SetPurpose(PhantomData S>); + impl sealed::Sealed for SetPurpose {} + impl State for SetPurpose { + type Uri = S::Uri; + type Name = S::Name; + type ItemCount = S::ItemCount; type Cid = S::Cid; + type Purpose = Set; + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Purpose = S::Purpose; type Uri = S::Uri; - type ItemCount = S::ItemCount; type Name = S::Name; + type ItemCount = S::ItemCount; + type Cid = S::Cid; + type Purpose = S::Purpose; type IndexedAt = Set; type Creator = S::Creator; - type Cid = S::Cid; } ///State transition - sets the `creator` field to Set pub struct SetCreator(PhantomData S>); impl sealed::Sealed for SetCreator {} impl State for SetCreator { - type Purpose = S::Purpose; type Uri = S::Uri; - type ItemCount = S::ItemCount; type Name = S::Name; - type IndexedAt = S::IndexedAt; - type Creator = Set; + type ItemCount = S::ItemCount; type Cid = S::Cid; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { type Purpose = S::Purpose; - type Uri = S::Uri; - type ItemCount = S::ItemCount; - type Name = S::Name; type IndexedAt = S::IndexedAt; - type Creator = S::Creator; - type Cid = Set; + type Creator = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `purpose` field - pub struct purpose(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `item_count` field - pub struct item_count(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `item_count` field + pub struct item_count(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `purpose` field + pub struct purpose(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `creator` field pub struct creator(()); - ///Marker type for the `cid` field - pub struct cid(()); } } @@ -1570,13 +1576,13 @@ impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { impl<'a, S> ListViewBuilder<'a, S> where S: list_view_state::State, - S::Purpose: list_view_state::IsSet, S::Uri: list_view_state::IsSet, - S::ItemCount: list_view_state::IsSet, S::Name: list_view_state::IsSet, + S::ItemCount: list_view_state::IsSet, + S::Cid: list_view_state::IsSet, + S::Purpose: list_view_state::IsSet, S::IndexedAt: list_view_state::IsSet, S::Creator: list_view_state::IsSet, - S::Cid: list_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListView<'a> { @@ -1630,7 +1636,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1690,51 +1696,51 @@ pub mod resource_tags_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CommunityTags; type Resource; type AuthorTags; - type CommunityTags; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CommunityTags = Unset; type Resource = Unset; type AuthorTags = Unset; - type CommunityTags = Unset; + } + ///State transition - sets the `community_tags` field to Set + pub struct SetCommunityTags(PhantomData S>); + impl sealed::Sealed for SetCommunityTags {} + impl State for SetCommunityTags { + type CommunityTags = Set; + type Resource = S::Resource; + type AuthorTags = S::AuthorTags; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { + type CommunityTags = S::CommunityTags; type Resource = Set; type AuthorTags = S::AuthorTags; - type CommunityTags = S::CommunityTags; } ///State transition - sets the `author_tags` field to Set pub struct SetAuthorTags(PhantomData S>); impl sealed::Sealed for SetAuthorTags {} impl State for SetAuthorTags { - type Resource = S::Resource; - type AuthorTags = Set; type CommunityTags = S::CommunityTags; - } - ///State transition - sets the `community_tags` field to Set - pub struct SetCommunityTags(PhantomData S>); - impl sealed::Sealed for SetCommunityTags {} - impl State for SetCommunityTags { type Resource = S::Resource; - type AuthorTags = S::AuthorTags; - type CommunityTags = Set; + type AuthorTags = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `community_tags` field + pub struct community_tags(()); ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `author_tags` field pub struct author_tags(()); - ///Marker type for the `community_tags` field - pub struct community_tags(()); } } @@ -1847,9 +1853,9 @@ impl<'a, S: resource_tags_view_state::State> ResourceTagsViewBuilder<'a, S> { impl<'a, S> ResourceTagsViewBuilder<'a, S> where S: resource_tags_view_state::State, + S::CommunityTags: resource_tags_view_state::IsSet, S::Resource: resource_tags_view_state::IsSet, S::AuthorTags: resource_tags_view_state::IsSet, - S::CommunityTags: resource_tags_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ResourceTagsView<'a> { @@ -1891,7 +1897,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResourceTagsView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1946,67 +1952,67 @@ pub mod tag_application_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AppliedBy; type CreatedAt; - type Tag; + type AppliedBy; type Uri; + type Tag; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AppliedBy = Unset; type CreatedAt = Unset; - type Tag = Unset; + type AppliedBy = Unset; type Uri = Unset; - } - ///State transition - sets the `applied_by` field to Set - pub struct SetAppliedBy(PhantomData S>); - impl sealed::Sealed for SetAppliedBy {} - impl State for SetAppliedBy { - type AppliedBy = Set; - type CreatedAt = S::CreatedAt; - type Tag = S::Tag; - type Uri = S::Uri; + type Tag = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type AppliedBy = S::AppliedBy; type CreatedAt = Set; - type Tag = S::Tag; + type AppliedBy = S::AppliedBy; type Uri = S::Uri; + type Tag = S::Tag; } - ///State transition - sets the `tag` field to Set - pub struct SetTag(PhantomData S>); - impl sealed::Sealed for SetTag {} - impl State for SetTag { - type AppliedBy = S::AppliedBy; + ///State transition - sets the `applied_by` field to Set + pub struct SetAppliedBy(PhantomData S>); + impl sealed::Sealed for SetAppliedBy {} + impl State for SetAppliedBy { type CreatedAt = S::CreatedAt; - type Tag = Set; + type AppliedBy = Set; type Uri = S::Uri; + type Tag = S::Tag; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type AppliedBy = S::AppliedBy; type CreatedAt = S::CreatedAt; - type Tag = S::Tag; + type AppliedBy = S::AppliedBy; type Uri = Set; + type Tag = S::Tag; + } + ///State transition - sets the `tag` field to Set + pub struct SetTag(PhantomData S>); + impl sealed::Sealed for SetTag {} + impl State for SetTag { + type CreatedAt = S::CreatedAt; + type AppliedBy = S::AppliedBy; + type Uri = S::Uri; + type Tag = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `applied_by` field - pub struct applied_by(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `tag` field - pub struct tag(()); + ///Marker type for the `applied_by` field + pub struct applied_by(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `tag` field + pub struct tag(()); } } @@ -2119,10 +2125,10 @@ where impl<'a, S> TagApplicationViewBuilder<'a, S> where S: tag_application_view_state::State, - S::AppliedBy: tag_application_view_state::IsSet, S::CreatedAt: tag_application_view_state::IsSet, - S::Tag: tag_application_view_state::IsSet, + S::AppliedBy: tag_application_view_state::IsSet, S::Uri: tag_application_view_state::IsSet, + S::Tag: tag_application_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TagApplicationView<'a> { @@ -2164,7 +2170,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TagApplicationView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2208,37 +2214,37 @@ pub mod tag_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Tag; type UseCount; + type Tag; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Tag = Unset; type UseCount = Unset; - } - ///State transition - sets the `tag` field to Set - pub struct SetTag(PhantomData S>); - impl sealed::Sealed for SetTag {} - impl State for SetTag { - type Tag = Set; - type UseCount = S::UseCount; + type Tag = Unset; } ///State transition - sets the `use_count` field to Set pub struct SetUseCount(PhantomData S>); impl sealed::Sealed for SetUseCount {} impl State for SetUseCount { - type Tag = S::Tag; type UseCount = Set; + type Tag = S::Tag; + } + ///State transition - sets the `tag` field to Set + pub struct SetTag(PhantomData S>); + impl sealed::Sealed for SetTag {} + impl State for SetTag { + type UseCount = S::UseCount; + type Tag = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `tag` field - pub struct tag(()); ///Marker type for the `use_count` field pub struct use_count(()); + ///Marker type for the `tag` field + pub struct tag(()); } } @@ -2367,8 +2373,8 @@ where impl<'a, S> TagViewBuilder<'a, S> where S: tag_view_state::State, - S::Tag: tag_view_state::IsSet, S::UseCount: tag_view_state::IsSet, + S::Tag: tag_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TagView<'a> { @@ -2414,7 +2420,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TagView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/graph/bookmark.rs b/crates/weaver-api/src/sh_weaver/graph/bookmark.rs index efc3d29..3df9e50 100644 --- a/crates/weaver-api/src/sh_weaver/graph/bookmark.rs +++ b/crates/weaver-api/src/sh_weaver/graph/bookmark.rs @@ -260,7 +260,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bookmark<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.note { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -304,7 +304,7 @@ fn lexicon_doc_sh_weaver_graph_bookmark() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -325,7 +325,7 @@ fn lexicon_doc_sh_weaver_graph_bookmark() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/follow.rs b/crates/weaver-api/src/sh_weaver/graph/follow.rs index c20dc16..e41bb28 100644 --- a/crates/weaver-api/src/sh_weaver/graph/follow.rs +++ b/crates/weaver-api/src/sh_weaver/graph/follow.rs @@ -34,37 +34,37 @@ pub mod follow_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject(PhantomData S>); - impl sealed::Sealed for SetSubject {} - impl State for SetSubject { - type Subject = Set; - type CreatedAt = S::CreatedAt; + type Subject = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Subject = S::Subject; type CreatedAt = Set; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type CreatedAt = S::CreatedAt; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> FollowBuilder<'a, S> where S: follow_state::State, - S::Subject: follow_state::IsSet, S::CreatedAt: follow_state::IsSet, + S::Subject: follow_state::IsSet, { /// Build the final struct pub fn build(self) -> Follow<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Follow<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_follow() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_graph_follow() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/follow_accept.rs b/crates/weaver-api/src/sh_weaver/graph/follow_accept.rs index f92a05f..506b20e 100644 --- a/crates/weaver-api/src/sh_weaver/graph/follow_accept.rs +++ b/crates/weaver-api/src/sh_weaver/graph/follow_accept.rs @@ -34,37 +34,37 @@ pub mod follow_accept_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Follow; type CreatedAt; + type Follow; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Follow = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `follow` field to Set - pub struct SetFollow(PhantomData S>); - impl sealed::Sealed for SetFollow {} - impl State for SetFollow { - type Follow = Set; - type CreatedAt = S::CreatedAt; + type Follow = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Follow = S::Follow; type CreatedAt = Set; + type Follow = S::Follow; + } + ///State transition - sets the `follow` field to Set + pub struct SetFollow(PhantomData S>); + impl sealed::Sealed for SetFollow {} + impl State for SetFollow { + type CreatedAt = S::CreatedAt; + type Follow = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `follow` field - pub struct follow(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `follow` field + pub struct follow(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> FollowAcceptBuilder<'a, S> where S: follow_accept_state::State, - S::Follow: follow_accept_state::IsSet, S::CreatedAt: follow_accept_state::IsSet, + S::Follow: follow_accept_state::IsSet, { /// Build the final struct pub fn build(self) -> FollowAccept<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowAccept<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_followAccept() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_graph_followAccept() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/follow_gate.rs b/crates/weaver-api/src/sh_weaver/graph/follow_gate.rs index 36a8b8e..34c8dbe 100644 --- a/crates/weaver-api/src/sh_weaver/graph/follow_gate.rs +++ b/crates/weaver-api/src/sh_weaver/graph/follow_gate.rs @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowGate<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_followGate() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -271,7 +271,7 @@ fn lexicon_doc_sh_weaver_graph_followGate() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/get_list.rs b/crates/weaver-api/src/sh_weaver/graph/get_list.rs index 79f137e..627a2b5 100644 --- a/crates/weaver-api/src/sh_weaver/graph/get_list.rs +++ b/crates/weaver-api/src/sh_weaver/graph/get_list.rs @@ -190,8 +190,8 @@ pub enum GetListError<'a> { ListNotFound(std::option::Option>), } -impl std::fmt::Display for GetListError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetListError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ListNotFound(msg) => { write!(f, "ListNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/graph/like.rs b/crates/weaver-api/src/sh_weaver/graph/like.rs index 0b7c5e1..e26326d 100644 --- a/crates/weaver-api/src/sh_weaver/graph/like.rs +++ b/crates/weaver-api/src/sh_weaver/graph/like.rs @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Like<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_like() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_graph_like() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/list.rs b/crates/weaver-api/src/sh_weaver/graph/list.rs index 559b722..f71b814 100644 --- a/crates/weaver-api/src/sh_weaver/graph/list.rs +++ b/crates/weaver-api/src/sh_weaver/graph/list.rs @@ -48,6 +48,12 @@ impl<'a> AsRef for ListPurpose<'a> { } } +impl<'a> core::fmt::Display for ListPurpose<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ListPurpose<'a> { fn serialize(&self, serializer: S) -> Result where @@ -123,51 +129,51 @@ pub mod list_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Name; type CreatedAt; type Purpose; - type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Name = Unset; type CreatedAt = Unset; type Purpose = Unset; - type Name = Unset; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Name = Set; + type CreatedAt = S::CreatedAt; + type Purpose = S::Purpose; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { + type Name = S::Name; type CreatedAt = Set; type Purpose = S::Purpose; - type Name = S::Name; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose(PhantomData S>); impl sealed::Sealed for SetPurpose {} impl State for SetPurpose { - type CreatedAt = S::CreatedAt; - type Purpose = Set; type Name = S::Name; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { type CreatedAt = S::CreatedAt; - type Purpose = S::Purpose; - type Name = Set; + type Purpose = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `purpose` field pub struct purpose(()); - ///Marker type for the `name` field - pub struct name(()); } } @@ -300,9 +306,9 @@ where impl<'a, S> ListBuilder<'a, S> where S: list_state::State, + S::Name: list_state::IsSet, S::CreatedAt: list_state::IsSet, S::Purpose: list_state::IsSet, - S::Name: list_state::IsSet, { /// Build the final struct pub fn build(self) -> List<'a> { @@ -407,7 +413,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for List<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -477,7 +483,7 @@ fn lexicon_doc_sh_weaver_graph_list() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("listPurpose"), ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { @@ -514,7 +520,7 @@ fn lexicon_doc_sh_weaver_graph_list() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { diff --git a/crates/weaver-api/src/sh_weaver/graph/listitem.rs b/crates/weaver-api/src/sh_weaver/graph/listitem.rs index 114f355..5910dc7 100644 --- a/crates/weaver-api/src/sh_weaver/graph/listitem.rs +++ b/crates/weaver-api/src/sh_weaver/graph/listitem.rs @@ -277,7 +277,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Listitem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -291,7 +291,7 @@ fn lexicon_doc_sh_weaver_graph_listitem() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -311,7 +311,7 @@ fn lexicon_doc_sh_weaver_graph_listitem() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/subscribe.rs b/crates/weaver-api/src/sh_weaver/graph/subscribe.rs index eae9514..a57472a 100644 --- a/crates/weaver-api/src/sh_weaver/graph/subscribe.rs +++ b/crates/weaver-api/src/sh_weaver/graph/subscribe.rs @@ -34,37 +34,37 @@ pub mod subscribe_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Notebook; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Notebook = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; - type Notebook = S::Notebook; + type CreatedAt = Unset; } ///State transition - sets the `notebook` field to Set pub struct SetNotebook(PhantomData S>); impl sealed::Sealed for SetNotebook {} impl State for SetNotebook { - type CreatedAt = S::CreatedAt; type Notebook = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Notebook = S::Notebook; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `notebook` field pub struct notebook(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> SubscribeBuilder<'a, S> where S: subscribe_state::State, - S::CreatedAt: subscribe_state::IsSet, S::Notebook: subscribe_state::IsSet, + S::CreatedAt: subscribe_state::IsSet, { /// Build the final struct pub fn build(self) -> Subscribe<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Subscribe<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_subscribe() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_graph_subscribe() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/subscribe_accept.rs b/crates/weaver-api/src/sh_weaver/graph/subscribe_accept.rs index 0062a2b..a85ffea 100644 --- a/crates/weaver-api/src/sh_weaver/graph/subscribe_accept.rs +++ b/crates/weaver-api/src/sh_weaver/graph/subscribe_accept.rs @@ -34,37 +34,37 @@ pub mod subscribe_accept_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subscribe; type CreatedAt; + type Subscribe; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subscribe = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subscribe` field to Set - pub struct SetSubscribe(PhantomData S>); - impl sealed::Sealed for SetSubscribe {} - impl State for SetSubscribe { - type Subscribe = Set; - type CreatedAt = S::CreatedAt; + type Subscribe = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Subscribe = S::Subscribe; type CreatedAt = Set; + type Subscribe = S::Subscribe; + } + ///State transition - sets the `subscribe` field to Set + pub struct SetSubscribe(PhantomData S>); + impl sealed::Sealed for SetSubscribe {} + impl State for SetSubscribe { + type CreatedAt = S::CreatedAt; + type Subscribe = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subscribe` field - pub struct subscribe(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subscribe` field + pub struct subscribe(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> SubscribeAcceptBuilder<'a, S> where S: subscribe_accept_state::State, - S::Subscribe: subscribe_accept_state::IsSet, S::CreatedAt: subscribe_accept_state::IsSet, + S::Subscribe: subscribe_accept_state::IsSet, { /// Build the final struct pub fn build(self) -> SubscribeAccept<'a> { @@ -237,7 +237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubscribeAccept<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -251,7 +251,7 @@ fn lexicon_doc_sh_weaver_graph_subscribeAccept() -> ::jacquard_lexicon::lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -272,7 +272,7 @@ fn lexicon_doc_sh_weaver_graph_subscribeAccept() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/graph/tag.rs b/crates/weaver-api/src/sh_weaver/graph/tag.rs index e8d1f99..7461c85 100644 --- a/crates/weaver-api/src/sh_weaver/graph/tag.rs +++ b/crates/weaver-api/src/sh_weaver/graph/tag.rs @@ -37,51 +37,51 @@ pub mod tag_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Tag; type CreatedAt; type Subject; - type Tag; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Tag = Unset; type CreatedAt = Unset; type Subject = Unset; - type Tag = Unset; + } + ///State transition - sets the `tag` field to Set + pub struct SetTag(PhantomData S>); + impl sealed::Sealed for SetTag {} + impl State for SetTag { + type Tag = Set; + type CreatedAt = S::CreatedAt; + type Subject = S::Subject; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { + type Tag = S::Tag; type CreatedAt = Set; type Subject = S::Subject; - type Tag = S::Tag; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type CreatedAt = S::CreatedAt; - type Subject = Set; type Tag = S::Tag; - } - ///State transition - sets the `tag` field to Set - pub struct SetTag(PhantomData S>); - impl sealed::Sealed for SetTag {} - impl State for SetTag { type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type Tag = Set; + type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `tag` field + pub struct tag(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); - ///Marker type for the `tag` field - pub struct tag(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> TagBuilder<'a, S> where S: tag_state::State, + S::Tag: tag_state::IsSet, S::CreatedAt: tag_state::IsSet, S::Subject: tag_state::IsSet, - S::Tag: tag_state::IsSet, { /// Build the final struct pub fn build(self) -> Tag<'a> { @@ -277,7 +277,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Tag<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.tag; #[allow(unused_comparisons)] @@ -317,7 +317,7 @@ fn lexicon_doc_sh_weaver_graph_tag() -> ::jacquard_lexicon::lexicon::LexiconDoc< revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -339,7 +339,7 @@ fn lexicon_doc_sh_weaver_graph_tag() -> ::jacquard_lexicon::lexicon::LexiconDoc< nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/notebook.rs b/crates/weaver-api/src/sh_weaver/notebook.rs index 72c59cd..788fa9e 100644 --- a/crates/weaver-api/src/sh_weaver/notebook.rs +++ b/crates/weaver-api/src/sh_weaver/notebook.rs @@ -228,7 +228,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authorListView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -242,7 +242,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("index"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -294,7 +294,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -323,7 +323,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -381,7 +381,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -443,7 +443,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -569,7 +569,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("markdown"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -659,7 +659,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -869,7 +869,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -916,7 +916,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("path"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -996,7 +996,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -1246,7 +1246,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1384,7 +1384,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1483,7 +1483,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("editors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -1543,7 +1543,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1664,7 +1664,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "currentEntry", @@ -1790,7 +1790,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("by"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1836,7 +1836,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("by"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -1881,7 +1881,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "indexedAt", @@ -1919,7 +1919,7 @@ fn lexicon_doc_sh_weaver_notebook_defs() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("css"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -1996,7 +1996,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AuthorListView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2134,7 +2134,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookEntryRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2359,7 +2359,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookEntryView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2584,7 +2584,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ChapterEntryView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -2633,105 +2633,105 @@ pub mod chapter_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; - type Uri; type Cid; + type Notebook; type Authors; - type Record; + type Uri; type IndexedAt; + type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; - type Uri = Unset; type Cid = Unset; + type Notebook = Unset; type Authors = Unset; - type Record = Unset; + type Uri = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook(PhantomData S>); - impl sealed::Sealed for SetNotebook {} - impl State for SetNotebook { - type Notebook = Set; - type Uri = S::Uri; - type Cid = S::Cid; - type Authors = S::Authors; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Notebook = S::Notebook; - type Uri = Set; - type Cid = S::Cid; - type Authors = S::Authors; - type Record = S::Record; - type IndexedAt = S::IndexedAt; + type Record = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Notebook = S::Notebook; - type Uri = S::Uri; type Cid = Set; + type Notebook = S::Notebook; type Authors = S::Authors; + type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Record = S::Record; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook(PhantomData S>); + impl sealed::Sealed for SetNotebook {} + impl State for SetNotebook { + type Cid = S::Cid; + type Notebook = Set; + type Authors = S::Authors; + type Uri = S::Uri; type IndexedAt = S::IndexedAt; + type Record = S::Record; } ///State transition - sets the `authors` field to Set pub struct SetAuthors(PhantomData S>); impl sealed::Sealed for SetAuthors {} impl State for SetAuthors { - type Notebook = S::Notebook; - type Uri = S::Uri; type Cid = S::Cid; + type Notebook = S::Notebook; type Authors = Set; - type Record = S::Record; + type Uri = S::Uri; type IndexedAt = S::IndexedAt; + type Record = S::Record; } - ///State transition - sets the `record` field to Set - pub struct SetRecord(PhantomData S>); - impl sealed::Sealed for SetRecord {} - impl State for SetRecord { - type Notebook = S::Notebook; - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { type Cid = S::Cid; + type Notebook = S::Notebook; type Authors = S::Authors; - type Record = Set; + type Uri = Set; type IndexedAt = S::IndexedAt; + type Record = S::Record; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { + type Cid = S::Cid; type Notebook = S::Notebook; + type Authors = S::Authors; type Uri = S::Uri; + type IndexedAt = Set; + type Record = S::Record; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData S>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { type Cid = S::Cid; + type Notebook = S::Notebook; type Authors = S::Authors; - type Record = S::Record; - type IndexedAt = Set; + type Uri = S::Uri; + type IndexedAt = S::IndexedAt; + type Record = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `notebook` field + pub struct notebook(()); ///Marker type for the `authors` field pub struct authors(()); - ///Marker type for the `record` field - pub struct record(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `record` field + pub struct record(()); } } @@ -2948,12 +2948,12 @@ where impl<'a, S> ChapterViewBuilder<'a, S> where S: chapter_view_state::State, - S::Notebook: chapter_view_state::IsSet, - S::Uri: chapter_view_state::IsSet, S::Cid: chapter_view_state::IsSet, + S::Notebook: chapter_view_state::IsSet, S::Authors: chapter_view_state::IsSet, - S::Record: chapter_view_state::IsSet, + S::Uri: chapter_view_state::IsSet, S::IndexedAt: chapter_view_state::IsSet, + S::Record: chapter_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ChapterView<'a> { @@ -3005,7 +3005,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ChapterView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3042,7 +3042,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContentFormat<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3099,6 +3099,12 @@ impl<'a> AsRef for ContentRating<'a> { } } +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(&self, serializer: S) -> Result where @@ -3214,6 +3220,12 @@ impl<'a> AsRef for ContentWarning<'a> { } } +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(&self, serializer: S) -> Result where @@ -3325,85 +3337,85 @@ pub mod entry_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; - type Authors; + type Uri; type Record; type IndexedAt; + type Authors; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - type Authors = Unset; + type Uri = Unset; type Record = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; - type Authors = S::Authors; - type Record = S::Record; - type IndexedAt = S::IndexedAt; + type Authors = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; - type Authors = S::Authors; + type Uri = S::Uri; type Record = S::Record; type IndexedAt = S::IndexedAt; + type Authors = S::Authors; } - ///State transition - sets the `authors` field to Set - pub struct SetAuthors(PhantomData S>); - impl sealed::Sealed for SetAuthors {} - impl State for SetAuthors { - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { type Cid = S::Cid; - type Authors = Set; + type Uri = Set; type Record = S::Record; type IndexedAt = S::IndexedAt; + type Authors = S::Authors; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Uri = S::Uri; type Cid = S::Cid; - type Authors = S::Authors; + type Uri = S::Uri; type Record = Set; type IndexedAt = S::IndexedAt; + type Authors = S::Authors; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Uri = S::Uri; type Cid = S::Cid; - type Authors = S::Authors; + type Uri = S::Uri; type Record = S::Record; type IndexedAt = Set; + type Authors = S::Authors; + } + ///State transition - sets the `authors` field to Set + pub struct SetAuthors(PhantomData S>); + impl sealed::Sealed for SetAuthors {} + impl State for SetAuthors { + type Cid = S::Cid; + type Uri = S::Uri; + type Record = S::Record; + type IndexedAt = S::IndexedAt; + type Authors = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `authors` field - pub struct authors(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `authors` field + pub struct authors(()); } } @@ -3740,11 +3752,11 @@ impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> { impl<'a, S> EntryViewBuilder<'a, S> where S: entry_view_state::State, - S::Uri: entry_view_state::IsSet, S::Cid: entry_view_state::IsSet, - S::Authors: entry_view_state::IsSet, + S::Uri: entry_view_state::IsSet, S::Record: entry_view_state::IsSet, S::IndexedAt: entry_view_state::IsSet, + S::Authors: entry_view_state::IsSet, { /// Build the final struct pub fn build(self) -> EntryView<'a> { @@ -3808,7 +3820,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EntryView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -3999,7 +4011,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedEntryView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4197,7 +4209,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedNotebookContext<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4295,83 +4307,83 @@ pub mod notebook_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; type Authors; type Record; + type Uri; type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; type Authors = Unset; type Record = Unset; + type Uri = Unset; type IndexedAt = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; - type Authors = S::Authors; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; type Authors = S::Authors; type Record = S::Record; + type Uri = S::Uri; type IndexedAt = S::IndexedAt; } ///State transition - sets the `authors` field to Set pub struct SetAuthors(PhantomData S>); impl sealed::Sealed for SetAuthors {} impl State for SetAuthors { - type Uri = S::Uri; type Cid = S::Cid; type Authors = Set; type Record = S::Record; + type Uri = S::Uri; type IndexedAt = S::IndexedAt; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { - type Uri = S::Uri; type Cid = S::Cid; type Authors = S::Authors; type Record = Set; + type Uri = S::Uri; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Authors = S::Authors; + type Record = S::Record; + type Uri = Set; type IndexedAt = S::IndexedAt; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type Uri = S::Uri; type Cid = S::Cid; type Authors = S::Authors; type Record = S::Record; + type Uri = S::Uri; type IndexedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `authors` field pub struct authors(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); } @@ -4740,10 +4752,10 @@ impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> { impl<'a, S> NotebookViewBuilder<'a, S> where S: notebook_view_state::State, - S::Uri: notebook_view_state::IsSet, S::Cid: notebook_view_state::IsSet, S::Authors: notebook_view_state::IsSet, S::Record: notebook_view_state::IsSet, + S::Uri: notebook_view_state::IsSet, S::IndexedAt: notebook_view_state::IsSet, { /// Build the final struct @@ -4812,7 +4824,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotebookView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4859,85 +4871,85 @@ pub mod page_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type Notebook; + type IndexedAt; type Uri; + type Notebook; + type Cid; type Record; - type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type Notebook = Unset; + type IndexedAt = Unset; type Uri = Unset; + type Notebook = Unset; + type Cid = Unset; type Record = Unset; - type IndexedAt = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Cid = Set; - type Notebook = S::Notebook; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type IndexedAt = Set; type Uri = S::Uri; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook(PhantomData S>); - impl sealed::Sealed for SetNotebook {} - impl State for SetNotebook { + type Notebook = S::Notebook; type Cid = S::Cid; - type Notebook = Set; - type Uri = S::Uri; type Record = S::Record; - type IndexedAt = S::IndexedAt; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Cid = S::Cid; - type Notebook = S::Notebook; + type IndexedAt = S::IndexedAt; type Uri = Set; + type Notebook = S::Notebook; + type Cid = S::Cid; type Record = S::Record; - type IndexedAt = S::IndexedAt; } - ///State transition - sets the `record` field to Set - pub struct SetRecord(PhantomData S>); - impl sealed::Sealed for SetRecord {} - impl State for SetRecord { - type Cid = S::Cid; - type Notebook = S::Notebook; - type Uri = S::Uri; - type Record = Set; + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook(PhantomData S>); + impl sealed::Sealed for SetNotebook {} + impl State for SetNotebook { type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { + type Uri = S::Uri; + type Notebook = Set; type Cid = S::Cid; - type Notebook = S::Notebook; + type Record = S::Record; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type IndexedAt = S::IndexedAt; type Uri = S::Uri; + type Notebook = S::Notebook; + type Cid = Set; type Record = S::Record; - type IndexedAt = Set; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData S>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Notebook = S::Notebook; + type Cid = S::Cid; + type Record = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `notebook` field - pub struct notebook(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `notebook` field + pub struct notebook(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `record` field pub struct record(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); } } @@ -5124,11 +5136,11 @@ where impl<'a, S> PageViewBuilder<'a, S> where S: page_view_state::State, - S::Cid: page_view_state::IsSet, - S::Notebook: page_view_state::IsSet, + S::IndexedAt: page_view_state::IsSet, S::Uri: page_view_state::IsSet, + S::Notebook: page_view_state::IsSet, + S::Cid: page_view_state::IsSet, S::Record: page_view_state::IsSet, - S::IndexedAt: page_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PageView<'a> { @@ -5178,7 +5190,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PageView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5204,7 +5216,7 @@ pub struct PermissionGrant<'a> { pub granted_at: jacquard_common::types::string::Datetime, /// direct = this resource (includes authority), inherited = via notebook invite #[serde(borrow)] - pub scope: jacquard_common::CowStr<'a>, + pub scope: PermissionGrantScope<'a>, /// For authority: resource URI. For invitees: invite URI #[serde(borrow)] pub source: jacquard_common::types::string::AtUri<'a>, @@ -5220,67 +5232,67 @@ pub mod permission_grant_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Source; + type Scope; type GrantedAt; type Did; - type Scope; - type Source; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Source = Unset; + type Scope = Unset; type GrantedAt = Unset; type Did = Unset; - type Scope = Unset; - type Source = Unset; + } + ///State transition - sets the `source` field to Set + pub struct SetSource(PhantomData S>); + impl sealed::Sealed for SetSource {} + impl State for SetSource { + type Source = Set; + type Scope = S::Scope; + type GrantedAt = S::GrantedAt; + type Did = S::Did; + } + ///State transition - sets the `scope` field to Set + pub struct SetScope(PhantomData S>); + impl sealed::Sealed for SetScope {} + impl State for SetScope { + type Source = S::Source; + type Scope = Set; + type GrantedAt = S::GrantedAt; + type Did = S::Did; } ///State transition - sets the `granted_at` field to Set pub struct SetGrantedAt(PhantomData S>); impl sealed::Sealed for SetGrantedAt {} impl State for SetGrantedAt { + type Source = S::Source; + type Scope = S::Scope; type GrantedAt = Set; type Did = S::Did; - type Scope = S::Scope; - type Source = S::Source; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type GrantedAt = S::GrantedAt; - type Did = Set; - type Scope = S::Scope; - type Source = S::Source; - } - ///State transition - sets the `scope` field to Set - pub struct SetScope(PhantomData S>); - impl sealed::Sealed for SetScope {} - impl State for SetScope { - type GrantedAt = S::GrantedAt; - type Did = S::Did; - type Scope = Set; type Source = S::Source; - } - ///State transition - sets the `source` field to Set - pub struct SetSource(PhantomData S>); - impl sealed::Sealed for SetSource {} - impl State for SetSource { - type GrantedAt = S::GrantedAt; - type Did = S::Did; type Scope = S::Scope; - type Source = Set; + type GrantedAt = S::GrantedAt; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `source` field + pub struct source(()); + ///Marker type for the `scope` field + pub struct scope(()); ///Marker type for the `granted_at` field pub struct granted_at(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `scope` field - pub struct scope(()); - ///Marker type for the `source` field - pub struct source(()); } } @@ -5290,7 +5302,7 @@ pub struct PermissionGrantBuilder<'a, S: permission_grant_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -5360,7 +5372,7 @@ where /// Set the `scope` field (required) pub fn scope( mut self, - value: impl Into>, + value: impl Into>, ) -> PermissionGrantBuilder<'a, permission_grant_state::SetScope> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); PermissionGrantBuilder { @@ -5393,10 +5405,10 @@ where impl<'a, S> PermissionGrantBuilder<'a, S> where S: permission_grant_state::State, + S::Source: permission_grant_state::IsSet, + S::Scope: permission_grant_state::IsSet, S::GrantedAt: permission_grant_state::IsSet, S::Did: permission_grant_state::IsSet, - S::Scope: permission_grant_state::IsSet, - S::Source: permission_grant_state::IsSet, { /// Build the final struct pub fn build(self) -> PermissionGrant<'a> { @@ -5426,6 +5438,97 @@ where } } +/// direct = this resource (includes authority), inherited = via notebook invite +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum PermissionGrantScope<'a> { + Direct, + Inherited, + Other(jacquard_common::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(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for PermissionGrantScope<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "direct" => Self::Direct, + "inherited" => Self::Inherited, + _ => Self::Other(jacquard_common::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 for PermissionGrantScope<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for PermissionGrantScope<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for PermissionGrantScope<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + 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()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PermissionGrant<'a> { fn nsid() -> &'static str { "sh.weaver.notebook.defs" @@ -5438,7 +5541,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PermissionGrant<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5606,7 +5709,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PermissionsState<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5655,66 +5758,66 @@ pub mod published_version_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; - type Publisher; type PublishedAt; type Uri; + type Publisher; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; - type Publisher = Unset; type PublishedAt = Unset; type Uri = Unset; + type Publisher = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type Cid = Set; - type Publisher = S::Publisher; - type PublishedAt = S::PublishedAt; - type Uri = S::Uri; - } - ///State transition - sets the `publisher` field to Set - pub struct SetPublisher(PhantomData S>); - impl sealed::Sealed for SetPublisher {} - impl State for SetPublisher { - type Cid = S::Cid; - type Publisher = Set; type PublishedAt = S::PublishedAt; type Uri = S::Uri; + type Publisher = S::Publisher; } ///State transition - sets the `published_at` field to Set pub struct SetPublishedAt(PhantomData S>); impl sealed::Sealed for SetPublishedAt {} impl State for SetPublishedAt { type Cid = S::Cid; - type Publisher = S::Publisher; type PublishedAt = Set; type Uri = S::Uri; + type Publisher = S::Publisher; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Cid = S::Cid; - type Publisher = S::Publisher; type PublishedAt = S::PublishedAt; type Uri = Set; + type Publisher = S::Publisher; + } + ///State transition - sets the `publisher` field to Set + pub struct SetPublisher(PhantomData S>); + impl sealed::Sealed for SetPublisher {} + impl State for SetPublisher { + type Cid = S::Cid; + type PublishedAt = S::PublishedAt; + type Uri = S::Uri; + type Publisher = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `publisher` field - pub struct publisher(()); ///Marker type for the `published_at` field pub struct published_at(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `publisher` field + pub struct publisher(()); } } @@ -5888,9 +5991,9 @@ impl<'a, S> PublishedVersionViewBuilder<'a, S> where S: published_version_view_state::State, S::Cid: published_version_view_state::IsSet, - S::Publisher: published_version_view_state::IsSet, S::PublishedAt: published_version_view_state::IsSet, S::Uri: published_version_view_state::IsSet, + S::Publisher: published_version_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PublishedVersionView<'a> { @@ -5938,7 +6041,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PublishedVersionView<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5971,7 +6074,107 @@ pub struct ReadingProgress<'a> { pub started_at: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ReadingProgressStatus<'a> { + Reading, + Finished, + Abandoned, + WantToRead, + Other(jacquard_common::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(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From 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(jacquard_common::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 for ReadingProgressStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ReadingProgressStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ReadingProgressStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + 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()) + } + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReadingProgress<'a> { @@ -5986,7 +6189,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReadingProgress<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.percent_complete { if *value > 100i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { @@ -6040,37 +6243,37 @@ pub mod reason_bookmark_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type By; type IndexedAt; + type By; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type By = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `by` field to Set - pub struct SetBy(PhantomData S>); - impl sealed::Sealed for SetBy {} - impl State for SetBy { - type By = Set; - type IndexedAt = S::IndexedAt; + type By = Unset; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type By = S::By; type IndexedAt = Set; + type By = S::By; + } + ///State transition - sets the `by` field to Set + pub struct SetBy(PhantomData S>); + impl sealed::Sealed for SetBy {} + impl State for SetBy { + type IndexedAt = S::IndexedAt; + type By = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `by` field - pub struct by(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `by` field + pub struct by(()); } } @@ -6143,8 +6346,8 @@ where impl<'a, S> ReasonBookmarkBuilder<'a, S> where S: reason_bookmark_state::State, - S::By: reason_bookmark_state::IsSet, S::IndexedAt: reason_bookmark_state::IsSet, + S::By: reason_bookmark_state::IsSet, { /// Build the final struct pub fn build(self) -> ReasonBookmark<'a> { @@ -6182,7 +6385,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReasonBookmark<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6214,37 +6417,37 @@ pub mod reason_like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type By; type IndexedAt; + type By; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type By = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `by` field to Set - pub struct SetBy(PhantomData S>); - impl sealed::Sealed for SetBy {} - impl State for SetBy { - type By = Set; - type IndexedAt = S::IndexedAt; + type By = Unset; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { - type By = S::By; type IndexedAt = Set; + type By = S::By; + } + ///State transition - sets the `by` field to Set + pub struct SetBy(PhantomData S>); + impl sealed::Sealed for SetBy {} + impl State for SetBy { + type IndexedAt = S::IndexedAt; + type By = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `by` field - pub struct by(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `by` field + pub struct by(()); } } @@ -6317,8 +6520,8 @@ where impl<'a, S> ReasonLikeBuilder<'a, S> where S: reason_like_state::State, - S::By: reason_like_state::IsSet, S::IndexedAt: reason_like_state::IsSet, + S::By: reason_like_state::IsSet, { /// Build the final struct pub fn build(self) -> ReasonLike<'a> { @@ -6356,7 +6559,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReasonLike<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6493,7 +6696,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReasonSubscription<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6657,7 +6860,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RenderedView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/sh_weaver/notebook/authors.rs b/crates/weaver-api/src/sh_weaver/notebook/authors.rs index 049ee65..b4ccdf6 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/authors.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/authors.rs @@ -171,7 +171,7 @@ fn lexicon_doc_sh_weaver_notebook_authors() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authorListItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -188,7 +188,7 @@ fn lexicon_doc_sh_weaver_notebook_authors() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("index"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -234,7 +234,7 @@ fn lexicon_doc_sh_weaver_notebook_authors() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "authorList", @@ -292,7 +292,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AuthorListItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -518,7 +518,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Authors<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/book.rs b/crates/weaver-api/src/sh_weaver/notebook/book.rs index 979ac9e..d6b0415 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/book.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/book.rs @@ -63,37 +63,37 @@ pub mod book_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EntryList; type Authors; + type EntryList; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EntryList = Unset; type Authors = Unset; - } - ///State transition - sets the `entry_list` field to Set - pub struct SetEntryList(PhantomData S>); - impl sealed::Sealed for SetEntryList {} - impl State for SetEntryList { - type EntryList = Set; - type Authors = S::Authors; + type EntryList = Unset; } ///State transition - sets the `authors` field to Set pub struct SetAuthors(PhantomData S>); impl sealed::Sealed for SetAuthors {} impl State for SetAuthors { - type EntryList = S::EntryList; type Authors = Set; + type EntryList = S::EntryList; + } + ///State transition - sets the `entry_list` field to Set + pub struct SetEntryList(PhantomData S>); + impl sealed::Sealed for SetEntryList {} + impl State for SetEntryList { + type Authors = S::Authors; + type EntryList = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `entry_list` field - pub struct entry_list(()); ///Marker type for the `authors` field pub struct authors(()); + ///Marker type for the `entry_list` field + pub struct entry_list(()); } } @@ -352,8 +352,8 @@ impl<'a, S: book_state::State> BookBuilder<'a, S> { impl<'a, S> BookBuilder<'a, S> where S: book_state::State, - S::EntryList: book_state::IsSet, S::Authors: book_state::IsSet, + S::EntryList: book_state::IsSet, { /// Build the final struct pub fn build(self) -> Book<'a> { @@ -470,7 +470,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Book<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -484,7 +484,7 @@ fn lexicon_doc_sh_weaver_notebook_book() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -505,7 +505,7 @@ fn lexicon_doc_sh_weaver_notebook_book() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { diff --git a/crates/weaver-api/src/sh_weaver/notebook/chapter.rs b/crates/weaver-api/src/sh_weaver/notebook/chapter.rs index 59bc8a6..a54908b 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/chapter.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/chapter.rs @@ -404,7 +404,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Chapter<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -418,7 +418,7 @@ fn lexicon_doc_sh_weaver_notebook_chapter() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -440,7 +440,7 @@ fn lexicon_doc_sh_weaver_notebook_chapter() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { diff --git a/crates/weaver-api/src/sh_weaver/notebook/colour_scheme.rs b/crates/weaver-api/src/sh_weaver/notebook/colour_scheme.rs index 1f3bee8..4483a55 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/colour_scheme.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/colour_scheme.rs @@ -38,51 +38,51 @@ pub mod colour_scheme_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Name; type Variant; type Colours; - type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Name = Unset; type Variant = Unset; type Colours = Unset; - type Name = Unset; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Name = Set; + type Variant = S::Variant; + type Colours = S::Colours; } ///State transition - sets the `variant` field to Set pub struct SetVariant(PhantomData S>); impl sealed::Sealed for SetVariant {} impl State for SetVariant { + type Name = S::Name; type Variant = Set; type Colours = S::Colours; - type Name = S::Name; } ///State transition - sets the `colours` field to Set pub struct SetColours(PhantomData S>); impl sealed::Sealed for SetColours {} impl State for SetColours { - type Variant = S::Variant; - type Colours = Set; type Name = S::Name; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { type Variant = S::Variant; - type Colours = S::Colours; - type Name = Set; + type Colours = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `variant` field pub struct variant(()); ///Marker type for the `colours` field pub struct colours(()); - ///Marker type for the `name` field - pub struct name(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> ColourSchemeBuilder<'a, S> where S: colour_scheme_state::State, + S::Name: colour_scheme_state::IsSet, S::Variant: colour_scheme_state::IsSet, S::Colours: colour_scheme_state::IsSet, - S::Name: colour_scheme_state::IsSet, { /// Build the final struct pub fn build(self) -> ColourScheme<'a> { @@ -290,7 +290,7 @@ fn lexicon_doc_sh_weaver_notebook_colourScheme() -> ::jacquard_lexicon::lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -312,7 +312,7 @@ fn lexicon_doc_sh_weaver_notebook_colourScheme() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("colours"), ::jacquard_lexicon::lexicon::LexObjectProperty::Object(::jacquard_lexicon::lexicon::LexObject { @@ -340,7 +340,7 @@ fn lexicon_doc_sh_weaver_notebook_colourScheme() -> ::jacquard_lexicon::lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("base"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -713,7 +713,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ColourSchemeColours<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -778,7 +778,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ColourScheme<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/entry.rs b/crates/weaver-api/src/sh_weaver/notebook/entry.rs index 7846aee..a036428 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/entry.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/entry.rs @@ -61,66 +61,66 @@ pub mod entry_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; - type Path; type Content; type Title; + type Path; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; - type Path = Unset; type Content = Unset; type Title = Unset; + type Path = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type CreatedAt = Set; - type Path = S::Path; - type Content = S::Content; - type Title = S::Title; - } - ///State transition - sets the `path` field to Set - pub struct SetPath(PhantomData S>); - impl sealed::Sealed for SetPath {} - impl State for SetPath { - type CreatedAt = S::CreatedAt; - type Path = Set; type Content = S::Content; type Title = S::Title; + type Path = S::Path; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { type CreatedAt = S::CreatedAt; - type Path = S::Path; type Content = Set; type Title = S::Title; + type Path = S::Path; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { type CreatedAt = S::CreatedAt; - type Path = S::Path; type Content = S::Content; type Title = Set; + type Path = S::Path; + } + ///State transition - sets the `path` field to Set + pub struct SetPath(PhantomData S>); + impl sealed::Sealed for SetPath {} + impl State for SetPath { + type CreatedAt = S::CreatedAt; + type Content = S::Content; + type Title = S::Title; + type Path = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `path` field - pub struct path(()); ///Marker type for the `content` field pub struct content(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `path` field + pub struct path(()); } } @@ -359,9 +359,9 @@ impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, S::CreatedAt: entry_state::IsSet, - S::Path: entry_state::IsSet, S::Content: entry_state::IsSet, S::Title: entry_state::IsSet, + S::Path: entry_state::IsSet, { /// Build the final struct pub fn build(self) -> Entry<'a> { @@ -458,7 +458,7 @@ fn lexicon_doc_sh_weaver_notebook_entry() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -479,7 +479,7 @@ fn lexicon_doc_sh_weaver_notebook_entry() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -559,7 +559,7 @@ fn lexicon_doc_sh_weaver_notebook_entry() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "externals", @@ -699,7 +699,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EntryEmbeds<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -764,7 +764,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entry<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_book_entry.rs b/crates/weaver-api/src/sh_weaver/notebook/get_book_entry.rs index eb24119..f6b8632 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_book_entry.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_book_entry.rs @@ -167,8 +167,8 @@ pub enum GetBookEntryError<'a> { EntryNotFound(std::option::Option>), } -impl std::fmt::Display for GetBookEntryError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetBookEntryError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_chapter.rs b/crates/weaver-api/src/sh_weaver/notebook/get_chapter.rs index 54b3601..f87ba57 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_chapter.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_chapter.rs @@ -193,8 +193,8 @@ pub enum GetChapterError<'a> { ChapterNotFound(std::option::Option>), } -impl std::fmt::Display for GetChapterError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetChapterError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ChapterNotFound(msg) => { write!(f, "ChapterNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_entry.rs b/crates/weaver-api/src/sh_weaver/notebook/get_entry.rs index c136610..4f2513b 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_entry.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_entry.rs @@ -147,8 +147,8 @@ pub enum GetEntryError<'a> { EntryNotFound(std::option::Option>), } -impl std::fmt::Display for GetEntryError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetEntryError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::EntryNotFound(msg) => { write!(f, "EntryNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_entry_by_title.rs b/crates/weaver-api/src/sh_weaver/notebook/get_entry_by_title.rs index 6893075..3e4488d 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_entry_by_title.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_entry_by_title.rs @@ -187,8 +187,8 @@ pub enum GetEntryByTitleError<'a> { EntryNotFound(std::option::Option>), } -impl std::fmt::Display for GetEntryByTitleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetEntryByTitleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_entry_detail.rs b/crates/weaver-api/src/sh_weaver/notebook/get_entry_detail.rs index 8db1bf1..0f4c285 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_entry_detail.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_entry_detail.rs @@ -178,8 +178,8 @@ pub enum GetEntryDetailError<'a> { EntryNotFound(std::option::Option>), } -impl std::fmt::Display for GetEntryDetailError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetEntryDetailError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::EntryNotFound(msg) => { write!(f, "EntryNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_entry_notebooks.rs b/crates/weaver-api/src/sh_weaver/notebook/get_entry_notebooks.rs index a5ee733..c44c50b 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_entry_notebooks.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_entry_notebooks.rs @@ -188,37 +188,37 @@ pub mod notebook_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type Uri = S::Uri; type Cid = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Cid = S::Cid; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -328,8 +328,8 @@ where impl<'a, S> NotebookRefBuilder<'a, S> where S: notebook_ref_state::State, - S::Uri: notebook_ref_state::IsSet, S::Cid: notebook_ref_state::IsSet, + S::Uri: notebook_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> NotebookRef<'a> { @@ -370,7 +370,7 @@ fn lexicon_doc_sh_weaver_notebook_getEntryNotebooks() -> ::jacquard_lexicon::lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -385,7 +385,7 @@ fn lexicon_doc_sh_weaver_notebook_getEntryNotebooks() -> ::jacquard_lexicon::lex ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -430,7 +430,7 @@ fn lexicon_doc_sh_weaver_notebook_getEntryNotebooks() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -510,7 +510,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotebookRef<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_notebook_by_title.rs b/crates/weaver-api/src/sh_weaver/notebook/get_notebook_by_title.rs index 6ed8bed..94d2695 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_notebook_by_title.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_notebook_by_title.rs @@ -184,8 +184,8 @@ pub enum GetNotebookByTitleError<'a> { NotebookNotFound(std::option::Option>), } -impl std::fmt::Display for GetNotebookByTitleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetNotebookByTitleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_notebook_detail.rs b/crates/weaver-api/src/sh_weaver/notebook/get_notebook_detail.rs index b94fa6e..6d73f07 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_notebook_detail.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_notebook_detail.rs @@ -193,8 +193,8 @@ pub enum GetNotebookDetailError<'a> { NotebookNotFound(std::option::Option>), } -impl std::fmt::Display for GetNotebookDetailError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetNotebookDetailError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_page.rs b/crates/weaver-api/src/sh_weaver/notebook/get_page.rs index 6b2e10b..b2973dd 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_page.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_page.rs @@ -148,8 +148,8 @@ pub enum GetPageError<'a> { PageNotFound(std::option::Option>), } -impl std::fmt::Display for GetPageError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetPageError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::PageNotFound(msg) => { write!(f, "PageNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_reading_history.rs b/crates/weaver-api/src/sh_weaver/notebook/get_reading_history.rs index ce2186d..0b24542 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_reading_history.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_reading_history.rs @@ -377,7 +377,7 @@ fn lexicon_doc_sh_weaver_notebook_getReadingHistory() -> ::jacquard_lexicon::lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -388,7 +388,7 @@ fn lexicon_doc_sh_weaver_notebook_getReadingHistory() -> ::jacquard_lexicon::lex required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -455,7 +455,7 @@ fn lexicon_doc_sh_weaver_notebook_getReadingHistory() -> ::jacquard_lexicon::lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "currentEntry", @@ -506,7 +506,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReadingHistoryItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/get_suggested_notebooks.rs b/crates/weaver-api/src/sh_weaver/notebook/get_suggested_notebooks.rs index c741fe3..3258a70 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/get_suggested_notebooks.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/get_suggested_notebooks.rs @@ -165,37 +165,37 @@ pub mod suggested_notebook_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; type Reason; + type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; type Reason = Unset; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook(PhantomData S>); - impl sealed::Sealed for SetNotebook {} - impl State for SetNotebook { - type Notebook = Set; - type Reason = S::Reason; + type Notebook = Unset; } ///State transition - sets the `reason` field to Set pub struct SetReason(PhantomData S>); impl sealed::Sealed for SetReason {} impl State for SetReason { - type Notebook = S::Notebook; type Reason = Set; + type Notebook = S::Notebook; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook(PhantomData S>); + impl sealed::Sealed for SetNotebook {} + impl State for SetNotebook { + type Reason = S::Reason; + type Notebook = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); ///Marker type for the `reason` field pub struct reason(()); + ///Marker type for the `notebook` field + pub struct notebook(()); } } @@ -286,8 +286,8 @@ impl<'a, S: suggested_notebook_state::State> SuggestedNotebookBuilder<'a, S> { impl<'a, S> SuggestedNotebookBuilder<'a, S> where S: suggested_notebook_state::State, - S::Notebook: suggested_notebook_state::IsSet, S::Reason: suggested_notebook_state::IsSet, + S::Notebook: suggested_notebook_state::IsSet, { /// Build the final struct pub fn build(self) -> SuggestedNotebook<'a> { @@ -326,7 +326,7 @@ fn lexicon_doc_sh_weaver_notebook_getSuggestedNotebooks() -> ::jacquard_lexicon: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -337,7 +337,7 @@ fn lexicon_doc_sh_weaver_notebook_getSuggestedNotebooks() -> ::jacquard_lexicon: required: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("limit"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -370,7 +370,7 @@ fn lexicon_doc_sh_weaver_notebook_getSuggestedNotebooks() -> ::jacquard_lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notebook"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -418,7 +418,7 @@ fn lexicon_doc_sh_weaver_notebook_getSuggestedNotebooks() -> ::jacquard_lexicon: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "relatedAuthor", @@ -512,7 +512,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SuggestedNotebook<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -552,7 +552,122 @@ pub struct SuggestionReason<'a> { #[serde(borrow)] pub related_tags: std::option::Option>>, #[serde(borrow)] - pub r#type: jacquard_common::CowStr<'a>, + pub r#type: SuggestionReasonType<'a>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SuggestionReasonType<'a> { + SimilarTags, + SimilarToLiked, + SimilarToRead, + FollowedAuthor, + PopularInTag, + Trending, + FromList, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SuggestionReasonType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::SimilarTags => "similar-tags", + Self::SimilarToLiked => "similar-to-liked", + Self::SimilarToRead => "similar-to-read", + Self::FollowedAuthor => "followed-author", + Self::PopularInTag => "popular-in-tag", + Self::Trending => "trending", + Self::FromList => "from-list", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SuggestionReasonType<'a> { + fn from(s: &'a str) -> Self { + match s { + "similar-tags" => Self::SimilarTags, + "similar-to-liked" => Self::SimilarToLiked, + "similar-to-read" => Self::SimilarToRead, + "followed-author" => Self::FollowedAuthor, + "popular-in-tag" => Self::PopularInTag, + "trending" => Self::Trending, + "from-list" => Self::FromList, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SuggestionReasonType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "similar-tags" => Self::SimilarTags, + "similar-to-liked" => Self::SimilarToLiked, + "similar-to-read" => Self::SimilarToRead, + "followed-author" => Self::FollowedAuthor, + "popular-in-tag" => Self::PopularInTag, + "trending" => Self::Trending, + "from-list" => Self::FromList, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SuggestionReasonType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SuggestionReasonType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SuggestionReasonType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SuggestionReasonType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SuggestionReasonType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SuggestionReasonType<'_> { + type Output = SuggestionReasonType<'static>; + fn into_static(self) -> Self::Output { + match self { + SuggestionReasonType::SimilarTags => SuggestionReasonType::SimilarTags, + SuggestionReasonType::SimilarToLiked => SuggestionReasonType::SimilarToLiked, + SuggestionReasonType::SimilarToRead => SuggestionReasonType::SimilarToRead, + SuggestionReasonType::FollowedAuthor => SuggestionReasonType::FollowedAuthor, + SuggestionReasonType::PopularInTag => SuggestionReasonType::PopularInTag, + SuggestionReasonType::Trending => SuggestionReasonType::Trending, + SuggestionReasonType::FromList => SuggestionReasonType::FromList, + SuggestionReasonType::Other(v) => { + SuggestionReasonType::Other(v.into_static()) + } + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SuggestionReason<'a> { @@ -567,7 +682,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SuggestionReason<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/page.rs b/crates/weaver-api/src/sh_weaver/notebook/page.rs index b3190f8..c212080 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/page.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/page.rs @@ -44,51 +44,51 @@ pub mod page_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Notebook; type EntryList; type Authors; - type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Notebook = Unset; type EntryList = Unset; type Authors = Unset; - type Notebook = Unset; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook(PhantomData S>); + impl sealed::Sealed for SetNotebook {} + impl State for SetNotebook { + type Notebook = Set; + type EntryList = S::EntryList; + type Authors = S::Authors; } ///State transition - sets the `entry_list` field to Set pub struct SetEntryList(PhantomData S>); impl sealed::Sealed for SetEntryList {} impl State for SetEntryList { + type Notebook = S::Notebook; type EntryList = Set; type Authors = S::Authors; - type Notebook = S::Notebook; } ///State transition - sets the `authors` field to Set pub struct SetAuthors(PhantomData S>); impl sealed::Sealed for SetAuthors {} impl State for SetAuthors { - type EntryList = S::EntryList; - type Authors = Set; type Notebook = S::Notebook; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook(PhantomData S>); - impl sealed::Sealed for SetNotebook {} - impl State for SetNotebook { type EntryList = S::EntryList; - type Authors = S::Authors; - type Notebook = Set; + type Authors = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `notebook` field + pub struct notebook(()); ///Marker type for the `entry_list` field pub struct entry_list(()); ///Marker type for the `authors` field pub struct authors(()); - ///Marker type for the `notebook` field - pub struct notebook(()); } } @@ -221,9 +221,9 @@ impl<'a, S: page_state::State> PageBuilder<'a, S> { impl<'a, S> PageBuilder<'a, S> where S: page_state::State, + S::Notebook: page_state::IsSet, S::EntryList: page_state::IsSet, S::Authors: page_state::IsSet, - S::Notebook: page_state::IsSet, { /// Build the final struct pub fn build(self) -> Page<'a> { @@ -328,7 +328,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Page<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -342,7 +342,7 @@ fn lexicon_doc_sh_weaver_notebook_page() -> ::jacquard_lexicon::lexicon::Lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -364,7 +364,7 @@ fn lexicon_doc_sh_weaver_notebook_page() -> ::jacquard_lexicon::lexicon::Lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", diff --git a/crates/weaver-api/src/sh_weaver/notebook/resolve_entry.rs b/crates/weaver-api/src/sh_weaver/notebook/resolve_entry.rs index 8a1693c..afce772 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/resolve_entry.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/resolve_entry.rs @@ -34,51 +34,51 @@ pub mod resolve_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; type Actor; type Entry; + type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; type Actor = Unset; type Entry = Unset; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook(PhantomData S>); - impl sealed::Sealed for SetNotebook {} - impl State for SetNotebook { - type Notebook = Set; - type Actor = S::Actor; - type Entry = S::Entry; + type Notebook = Unset; } ///State transition - sets the `actor` field to Set pub struct SetActor(PhantomData S>); impl sealed::Sealed for SetActor {} impl State for SetActor { - type Notebook = S::Notebook; type Actor = Set; type Entry = S::Entry; + type Notebook = S::Notebook; } ///State transition - sets the `entry` field to Set pub struct SetEntry(PhantomData S>); impl sealed::Sealed for SetEntry {} impl State for SetEntry { - type Notebook = S::Notebook; type Actor = S::Actor; type Entry = Set; + type Notebook = S::Notebook; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook(PhantomData S>); + impl sealed::Sealed for SetNotebook {} + impl State for SetNotebook { + type Actor = S::Actor; + type Entry = S::Entry; + type Notebook = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); ///Marker type for the `actor` field pub struct actor(()); ///Marker type for the `entry` field pub struct entry(()); + ///Marker type for the `notebook` field + pub struct notebook(()); } } @@ -171,9 +171,9 @@ where impl<'a, S> ResolveEntryBuilder<'a, S> where S: resolve_entry_state::State, - S::Notebook: resolve_entry_state::IsSet, S::Actor: resolve_entry_state::IsSet, S::Entry: resolve_entry_state::IsSet, + S::Notebook: resolve_entry_state::IsSet, { /// Build the final struct pub fn build(self) -> ResolveEntry<'a> { @@ -230,8 +230,8 @@ pub enum ResolveEntryError<'a> { EntryNotFound(std::option::Option>), } -impl std::fmt::Display for ResolveEntryError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveEntryError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/resolve_notebook.rs b/crates/weaver-api/src/sh_weaver/notebook/resolve_notebook.rs index 21ad71b..baed045 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/resolve_notebook.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/resolve_notebook.rs @@ -229,8 +229,8 @@ pub enum ResolveNotebookError<'a> { NotebookNotFound(std::option::Option>), } -impl std::fmt::Display for ResolveNotebookError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveNotebookError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NotebookNotFound(msg) => { write!(f, "NotebookNotFound")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/resolve_version_conflict.rs b/crates/weaver-api/src/sh_weaver/notebook/resolve_version_conflict.rs index baf4741..5115a5a 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/resolve_version_conflict.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/resolve_version_conflict.rs @@ -157,8 +157,8 @@ pub enum ResolveVersionConflictError<'a> { NoRelatedVersions(std::option::Option>), } -impl std::fmt::Display for ResolveVersionConflictError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for ResolveVersionConflictError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::NoRelatedVersions(msg) => { write!(f, "NoRelatedVersions")?; diff --git a/crates/weaver-api/src/sh_weaver/notebook/theme.rs b/crates/weaver-api/src/sh_weaver/notebook/theme.rs index 4913b20..5ecdc5a 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/theme.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/theme.rs @@ -36,51 +36,51 @@ pub mod code_theme_file_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Content; type Name; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Content = Unset; type Name = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - type Content = S::Content; - type Name = S::Name; + type Did = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { - type Did = S::Did; type Content = Set; type Name = S::Name; + type Did = S::Did; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { - type Did = S::Did; type Content = S::Content; type Name = Set; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Content = S::Content; + type Name = S::Name; + type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `content` field pub struct content(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -173,9 +173,9 @@ where impl<'a, S> CodeThemeFileBuilder<'a, S> where S: code_theme_file_state::State, - S::Did: code_theme_file_state::IsSet, S::Content: code_theme_file_state::IsSet, S::Name: code_theme_file_state::IsSet, + S::Did: code_theme_file_state::IsSet, { /// Build the final struct pub fn build(self) -> CodeThemeFile<'a> { @@ -212,7 +212,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("codeThemeFile"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -231,7 +231,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -301,7 +301,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -337,7 +337,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { @@ -419,7 +419,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "darkCodeTheme", @@ -483,7 +483,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("body"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -568,7 +568,7 @@ fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "baseSize", @@ -644,7 +644,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CodeThemeFile<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -801,7 +801,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Font<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -838,50 +838,50 @@ pub mod font_file_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Content; - type Name; type Did; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Content = Unset; - type Name = Unset; type Did = Unset; + type Name = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { type Content = Set; - type Name = S::Name; - type Did = S::Did; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Content = S::Content; - type Name = Set; type Did = S::Did; + type Name = S::Name; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Content = S::Content; - type Name = S::Name; type Did = Set; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Content = S::Content; + type Did = S::Did; + type Name = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `content` field pub struct content(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -975,8 +975,8 @@ impl<'a, S> FontFileBuilder<'a, S> where S: font_file_state::State, S::Content: font_file_state::IsSet, - S::Name: font_file_state::IsSet, S::Did: font_file_state::IsSet, + S::Name: font_file_state::IsSet, { /// Build the final struct pub fn build(self) -> FontFile<'a> { @@ -1016,7 +1016,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FontFile<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1068,104 +1068,104 @@ pub mod theme_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type LightScheme; + type Spacing; + type LightCodeTheme; type DarkScheme; type DarkCodeTheme; - type LightCodeTheme; type Fonts; - type Spacing; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type LightScheme = Unset; + type Spacing = Unset; + type LightCodeTheme = Unset; type DarkScheme = Unset; type DarkCodeTheme = Unset; - type LightCodeTheme = Unset; type Fonts = Unset; - type Spacing = Unset; } ///State transition - sets the `light_scheme` field to Set pub struct SetLightScheme(PhantomData S>); impl sealed::Sealed for SetLightScheme {} impl State for SetLightScheme { type LightScheme = Set; + type Spacing = S::Spacing; + type LightCodeTheme = S::LightCodeTheme; type DarkScheme = S::DarkScheme; type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = S::Fonts; + } + ///State transition - sets the `spacing` field to Set + pub struct SetSpacing(PhantomData S>); + impl sealed::Sealed for SetSpacing {} + impl State for SetSpacing { + type LightScheme = S::LightScheme; + type Spacing = Set; type LightCodeTheme = S::LightCodeTheme; + type DarkScheme = S::DarkScheme; + type DarkCodeTheme = S::DarkCodeTheme; type Fonts = S::Fonts; + } + ///State transition - sets the `light_code_theme` field to Set + pub struct SetLightCodeTheme(PhantomData S>); + impl sealed::Sealed for SetLightCodeTheme {} + impl State for SetLightCodeTheme { + type LightScheme = S::LightScheme; type Spacing = S::Spacing; + type LightCodeTheme = Set; + type DarkScheme = S::DarkScheme; + type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = S::Fonts; } ///State transition - sets the `dark_scheme` field to Set pub struct SetDarkScheme(PhantomData S>); impl sealed::Sealed for SetDarkScheme {} impl State for SetDarkScheme { type LightScheme = S::LightScheme; + type Spacing = S::Spacing; + type LightCodeTheme = S::LightCodeTheme; type DarkScheme = Set; type DarkCodeTheme = S::DarkCodeTheme; - type LightCodeTheme = S::LightCodeTheme; type Fonts = S::Fonts; - type Spacing = S::Spacing; } ///State transition - sets the `dark_code_theme` field to Set pub struct SetDarkCodeTheme(PhantomData S>); impl sealed::Sealed for SetDarkCodeTheme {} impl State for SetDarkCodeTheme { type LightScheme = S::LightScheme; - type DarkScheme = S::DarkScheme; - type DarkCodeTheme = Set; - type LightCodeTheme = S::LightCodeTheme; - type Fonts = S::Fonts; type Spacing = S::Spacing; - } - ///State transition - sets the `light_code_theme` field to Set - pub struct SetLightCodeTheme(PhantomData S>); - impl sealed::Sealed for SetLightCodeTheme {} - impl State for SetLightCodeTheme { - type LightScheme = S::LightScheme; + type LightCodeTheme = S::LightCodeTheme; type DarkScheme = S::DarkScheme; - type DarkCodeTheme = S::DarkCodeTheme; - type LightCodeTheme = Set; + type DarkCodeTheme = Set; type Fonts = S::Fonts; - type Spacing = S::Spacing; } ///State transition - sets the `fonts` field to Set pub struct SetFonts(PhantomData S>); impl sealed::Sealed for SetFonts {} impl State for SetFonts { type LightScheme = S::LightScheme; - type DarkScheme = S::DarkScheme; - type DarkCodeTheme = S::DarkCodeTheme; - type LightCodeTheme = S::LightCodeTheme; - type Fonts = Set; type Spacing = S::Spacing; - } - ///State transition - sets the `spacing` field to Set - pub struct SetSpacing(PhantomData S>); - impl sealed::Sealed for SetSpacing {} - impl State for SetSpacing { - type LightScheme = S::LightScheme; + type LightCodeTheme = S::LightCodeTheme; type DarkScheme = S::DarkScheme; type DarkCodeTheme = S::DarkCodeTheme; - type LightCodeTheme = S::LightCodeTheme; - type Fonts = S::Fonts; - type Spacing = Set; + type Fonts = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `light_scheme` field pub struct light_scheme(()); + ///Marker type for the `spacing` field + pub struct spacing(()); + ///Marker type for the `light_code_theme` field + pub struct light_code_theme(()); ///Marker type for the `dark_scheme` field pub struct dark_scheme(()); ///Marker type for the `dark_code_theme` field pub struct dark_code_theme(()); - ///Marker type for the `light_code_theme` field - pub struct light_code_theme(()); ///Marker type for the `fonts` field pub struct fonts(()); - ///Marker type for the `spacing` field - pub struct spacing(()); } } @@ -1339,11 +1339,11 @@ impl<'a, S> ThemeBuilder<'a, S> where S: theme_state::State, S::LightScheme: theme_state::IsSet, + S::Spacing: theme_state::IsSet, + S::LightCodeTheme: theme_state::IsSet, S::DarkScheme: theme_state::IsSet, S::DarkCodeTheme: theme_state::IsSet, - S::LightCodeTheme: theme_state::IsSet, S::Fonts: theme_state::IsSet, - S::Spacing: theme_state::IsSet, { /// Build the final struct pub fn build(self) -> Theme<'a> { @@ -1442,51 +1442,51 @@ pub mod theme_fonts_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Body; type Heading; type Monospace; - type Body; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Body = Unset; type Heading = Unset; type Monospace = Unset; - type Body = Unset; + } + ///State transition - sets the `body` field to Set + pub struct SetBody(PhantomData S>); + impl sealed::Sealed for SetBody {} + impl State for SetBody { + type Body = Set; + type Heading = S::Heading; + type Monospace = S::Monospace; } ///State transition - sets the `heading` field to Set pub struct SetHeading(PhantomData S>); impl sealed::Sealed for SetHeading {} impl State for SetHeading { + type Body = S::Body; type Heading = Set; type Monospace = S::Monospace; - type Body = S::Body; } ///State transition - sets the `monospace` field to Set pub struct SetMonospace(PhantomData S>); impl sealed::Sealed for SetMonospace {} impl State for SetMonospace { - type Heading = S::Heading; - type Monospace = Set; type Body = S::Body; - } - ///State transition - sets the `body` field to Set - pub struct SetBody(PhantomData S>); - impl sealed::Sealed for SetBody {} - impl State for SetBody { type Heading = S::Heading; - type Monospace = S::Monospace; - type Body = Set; + type Monospace = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `body` field + pub struct body(()); ///Marker type for the `heading` field pub struct heading(()); ///Marker type for the `monospace` field pub struct monospace(()); - ///Marker type for the `body` field - pub struct body(()); } } @@ -1579,9 +1579,9 @@ where impl<'a, S> ThemeFontsBuilder<'a, S> where S: theme_fonts_state::State, + S::Body: theme_fonts_state::IsSet, S::Heading: theme_fonts_state::IsSet, S::Monospace: theme_fonts_state::IsSet, - S::Body: theme_fonts_state::IsSet, { /// Build the final struct pub fn build(self) -> ThemeFonts<'a> { @@ -1621,7 +1621,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThemeFonts<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1678,7 +1678,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThemeSpacing<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1743,7 +1743,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/notebook/update_reading_progress.rs b/crates/weaver-api/src/sh_weaver/notebook/update_reading_progress.rs index bcd866d..1fce387 100644 --- a/crates/weaver-api/src/sh_weaver/notebook/update_reading_progress.rs +++ b/crates/weaver-api/src/sh_weaver/notebook/update_reading_progress.rs @@ -27,7 +27,7 @@ pub struct UpdateReadingProgress<'a> { pub percent_complete: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, } pub mod update_reading_progress_state { @@ -69,7 +69,7 @@ pub struct UpdateReadingProgressBuilder<'a, S: update_reading_progress_state::St ::core::option::Option>, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -153,13 +153,16 @@ impl<'a, S: update_reading_progress_state::State> UpdateReadingProgressBuilder<' /// Set the `status` field (optional) pub fn status( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status( + mut self, + value: Option>, + ) -> Self { self.__unsafe_private_named.3 = value; self } @@ -198,6 +201,112 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpdateReadingProgressStatus<'a> { + Reading, + Finished, + Abandoned, + WantToRead, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpdateReadingProgressStatus<'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 UpdateReadingProgressStatus<'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(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpdateReadingProgressStatus<'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(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpdateReadingProgressStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpdateReadingProgressStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpdateReadingProgressStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpdateReadingProgressStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpdateReadingProgressStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpdateReadingProgressStatus<'_> { + type Output = UpdateReadingProgressStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + UpdateReadingProgressStatus::Reading => UpdateReadingProgressStatus::Reading, + UpdateReadingProgressStatus::Finished => { + UpdateReadingProgressStatus::Finished + } + UpdateReadingProgressStatus::Abandoned => { + UpdateReadingProgressStatus::Abandoned + } + UpdateReadingProgressStatus::WantToRead => { + UpdateReadingProgressStatus::WantToRead + } + UpdateReadingProgressStatus::Other(v) => { + UpdateReadingProgressStatus::Other(v.into_static()) + } + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, diff --git a/crates/weaver-api/src/sh_weaver/notification.rs b/crates/weaver-api/src/sh_weaver/notification.rs index f855444..811e8f7 100644 --- a/crates/weaver-api/src/sh_weaver/notification.rs +++ b/crates/weaver-api/src/sh_weaver/notification.rs @@ -52,105 +52,105 @@ pub mod notification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Reason; - type Author; + type Cid; + type IndexedAt; type IsRead; + type Author; + type Reason; type Uri; - type IndexedAt; - type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Reason = Unset; - type Author = Unset; + type Cid = Unset; + type IndexedAt = Unset; type IsRead = Unset; + type Author = Unset; + type Reason = Unset; type Uri = Unset; - type IndexedAt = Unset; - type Cid = Unset; } - ///State transition - sets the `reason` field to Set - pub struct SetReason(PhantomData S>); - impl sealed::Sealed for SetReason {} - impl State for SetReason { - type Reason = Set; - type Author = S::Author; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Cid = Set; + type IndexedAt = S::IndexedAt; type IsRead = S::IsRead; + type Author = S::Author; + type Reason = S::Reason; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; } - ///State transition - sets the `author` field to Set - pub struct SetAuthor(PhantomData S>); - impl sealed::Sealed for SetAuthor {} - impl State for SetAuthor { - type Reason = S::Reason; - type Author = Set; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type Cid = S::Cid; + type IndexedAt = Set; type IsRead = S::IsRead; + type Author = S::Author; + type Reason = S::Reason; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; } ///State transition - sets the `is_read` field to Set pub struct SetIsRead(PhantomData S>); impl sealed::Sealed for SetIsRead {} impl State for SetIsRead { - type Reason = S::Reason; - type Author = S::Author; + type Cid = S::Cid; + type IndexedAt = S::IndexedAt; type IsRead = Set; + type Author = S::Author; + type Reason = S::Reason; type Uri = S::Uri; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor(PhantomData S>); + impl sealed::Sealed for SetAuthor {} + impl State for SetAuthor { + type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type IsRead = S::IsRead; + type Author = Set; + type Reason = S::Reason; + type Uri = S::Uri; + } + ///State transition - sets the `reason` field to Set + pub struct SetReason(PhantomData S>); + impl sealed::Sealed for SetReason {} + impl State for SetReason { type Cid = S::Cid; + type IndexedAt = S::IndexedAt; + type IsRead = S::IsRead; + type Author = S::Author; + type Reason = Set; + type Uri = S::Uri; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Reason = S::Reason; - type Author = S::Author; - type IsRead = S::IsRead; - type Uri = Set; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Reason = S::Reason; - type Author = S::Author; + type IndexedAt = S::IndexedAt; type IsRead = S::IsRead; - type Uri = S::Uri; - type IndexedAt = Set; - type Cid = S::Cid; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Reason = S::Reason; type Author = S::Author; - type IsRead = S::IsRead; - type Uri = S::Uri; - type IndexedAt = S::IndexedAt; - type Cid = Set; + type Reason = S::Reason; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `reason` field - pub struct reason(()); - ///Marker type for the `author` field - pub struct author(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `is_read` field pub struct is_read(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `reason` field + pub struct reason(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `cid` field - pub struct cid(()); } } @@ -343,12 +343,12 @@ where impl<'a, S> NotificationBuilder<'a, S> where S: notification_state::State, - S::Reason: notification_state::IsSet, - S::Author: notification_state::IsSet, + S::Cid: notification_state::IsSet, + S::IndexedAt: notification_state::IsSet, S::IsRead: notification_state::IsSet, + S::Author: notification_state::IsSet, + S::Reason: notification_state::IsSet, S::Uri: notification_state::IsSet, - S::IndexedAt: notification_state::IsSet, - S::Cid: notification_state::IsSet, { /// Build the final struct pub fn build(self) -> Notification<'a> { @@ -395,7 +395,7 @@ fn lexicon_doc_sh_weaver_notification_defs() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notification"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -417,7 +417,7 @@ fn lexicon_doc_sh_weaver_notification_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("author"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -550,7 +550,7 @@ fn lexicon_doc_sh_weaver_notification_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actors"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -670,7 +670,7 @@ fn lexicon_doc_sh_weaver_notification_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "newEntries", @@ -760,7 +760,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Notification<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -801,83 +801,83 @@ pub mod notification_group_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Reason; type Actors; type Subject; type Count; - type Reason; type MostRecentAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Reason = Unset; type Actors = Unset; type Subject = Unset; type Count = Unset; - type Reason = Unset; type MostRecentAt = Unset; } + ///State transition - sets the `reason` field to Set + pub struct SetReason(PhantomData S>); + impl sealed::Sealed for SetReason {} + impl State for SetReason { + type Reason = Set; + type Actors = S::Actors; + type Subject = S::Subject; + type Count = S::Count; + type MostRecentAt = S::MostRecentAt; + } ///State transition - sets the `actors` field to Set pub struct SetActors(PhantomData S>); impl sealed::Sealed for SetActors {} impl State for SetActors { + type Reason = S::Reason; type Actors = Set; type Subject = S::Subject; type Count = S::Count; - type Reason = S::Reason; type MostRecentAt = S::MostRecentAt; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { + type Reason = S::Reason; type Actors = S::Actors; type Subject = Set; type Count = S::Count; - type Reason = S::Reason; type MostRecentAt = S::MostRecentAt; } ///State transition - sets the `count` field to Set pub struct SetCount(PhantomData S>); impl sealed::Sealed for SetCount {} impl State for SetCount { - type Actors = S::Actors; - type Subject = S::Subject; - type Count = Set; type Reason = S::Reason; - type MostRecentAt = S::MostRecentAt; - } - ///State transition - sets the `reason` field to Set - pub struct SetReason(PhantomData S>); - impl sealed::Sealed for SetReason {} - impl State for SetReason { type Actors = S::Actors; type Subject = S::Subject; - type Count = S::Count; - type Reason = Set; + type Count = Set; type MostRecentAt = S::MostRecentAt; } ///State transition - sets the `most_recent_at` field to Set pub struct SetMostRecentAt(PhantomData S>); impl sealed::Sealed for SetMostRecentAt {} impl State for SetMostRecentAt { + type Reason = S::Reason; type Actors = S::Actors; type Subject = S::Subject; type Count = S::Count; - type Reason = S::Reason; type MostRecentAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `reason` field + pub struct reason(()); ///Marker type for the `actors` field pub struct actors(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `count` field pub struct count(()); - ///Marker type for the `reason` field - pub struct reason(()); ///Marker type for the `most_recent_at` field pub struct most_recent_at(()); } @@ -1026,10 +1026,10 @@ where impl<'a, S> NotificationGroupBuilder<'a, S> where S: notification_group_state::State, + S::Reason: notification_group_state::IsSet, S::Actors: notification_group_state::IsSet, S::Subject: notification_group_state::IsSet, S::Count: notification_group_state::IsSet, - S::Reason: notification_group_state::IsSet, S::MostRecentAt: notification_group_state::IsSet, { /// Build the final struct @@ -1095,7 +1095,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotificationGroup<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.actors; #[allow(unused_comparisons)] @@ -1201,6 +1201,12 @@ impl<'a> AsRef for NotificationReason<'a> { } } +impl<'a> core::fmt::Display for NotificationReason<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for NotificationReason<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1499,7 +1505,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubscriptionUpdateView<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/sh_weaver/publish/blob.rs b/crates/weaver-api/src/sh_weaver/publish/blob.rs index c532043..b122ec2 100644 --- a/crates/weaver-api/src/sh_weaver/publish/blob.rs +++ b/crates/weaver-api/src/sh_weaver/publish/blob.rs @@ -36,37 +36,37 @@ pub mod blob_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Upload; type Path; + type Upload; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Upload = Unset; type Path = Unset; - } - ///State transition - sets the `upload` field to Set - pub struct SetUpload(PhantomData S>); - impl sealed::Sealed for SetUpload {} - impl State for SetUpload { - type Upload = Set; - type Path = S::Path; + type Upload = Unset; } ///State transition - sets the `path` field to Set pub struct SetPath(PhantomData S>); impl sealed::Sealed for SetPath {} impl State for SetPath { - type Upload = S::Upload; type Path = Set; + type Upload = S::Upload; + } + ///State transition - sets the `upload` field to Set + pub struct SetUpload(PhantomData S>); + impl sealed::Sealed for SetUpload {} + impl State for SetUpload { + type Path = S::Path; + type Upload = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `upload` field - pub struct upload(()); ///Marker type for the `path` field pub struct path(()); + ///Marker type for the `upload` field + pub struct upload(()); } } @@ -139,8 +139,8 @@ where impl<'a, S> BlobBuilder<'a, S> where S: blob_state::State, - S::Upload: blob_state::IsSet, S::Path: blob_state::IsSet, + S::Upload: blob_state::IsSet, { /// Build the final struct pub fn build(self) -> Blob<'a> { @@ -239,7 +239,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Blob<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.path; #[allow(unused_comparisons)] @@ -266,7 +266,7 @@ fn lexicon_doc_sh_weaver_publish_blob() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { @@ -287,7 +287,7 @@ fn lexicon_doc_sh_weaver_publish_blob() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("path"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { diff --git a/crates/weaver-api/src/site_standard/document.rs b/crates/weaver-api/src/site_standard/document.rs index 5035fb4..ece9fe0 100644 --- a/crates/weaver-api/src/site_standard/document.rs +++ b/crates/weaver-api/src/site_standard/document.rs @@ -60,49 +60,49 @@ pub mod document_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Publication; type Title; + type Publication; type PublishedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Publication = Unset; type Title = Unset; + type Publication = Unset; type PublishedAt = Unset; } - ///State transition - sets the `publication` field to Set - pub struct SetPublication(PhantomData S>); - impl sealed::Sealed for SetPublication {} - impl State for SetPublication { - type Publication = Set; - type Title = S::Title; - type PublishedAt = S::PublishedAt; - } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { - type Publication = S::Publication; type Title = Set; + type Publication = S::Publication; + type PublishedAt = S::PublishedAt; + } + ///State transition - sets the `publication` field to Set + pub struct SetPublication(PhantomData S>); + impl sealed::Sealed for SetPublication {} + impl State for SetPublication { + type Title = S::Title; + type Publication = Set; type PublishedAt = S::PublishedAt; } ///State transition - sets the `published_at` field to Set pub struct SetPublishedAt(PhantomData S>); impl sealed::Sealed for SetPublishedAt {} impl State for SetPublishedAt { - type Publication = S::Publication; type Title = S::Title; + type Publication = S::Publication; type PublishedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `publication` field - pub struct publication(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `publication` field + pub struct publication(()); ///Marker type for the `published_at` field pub struct published_at(()); } @@ -366,8 +366,8 @@ impl<'a, S: document_state::State> DocumentBuilder<'a, S> { impl<'a, S> DocumentBuilder<'a, S> where S: document_state::State, - S::Publication: document_state::IsSet, S::Title: document_state::IsSet, + S::Publication: document_state::IsSet, S::PublishedAt: document_state::IsSet, { /// Build the final struct @@ -421,7 +421,7 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -436,7 +436,7 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "bskyPostRef", @@ -637,7 +637,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Document<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { diff --git a/crates/weaver-api/src/site_standard/publication.rs b/crates/weaver-api/src/site_standard/publication.rs index fdf93fe..9d58918 100644 --- a/crates/weaver-api/src/site_standard/publication.rs +++ b/crates/weaver-api/src/site_standard/publication.rs @@ -47,37 +47,37 @@ pub mod publication_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Url; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Url = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Name = Set; - type Url = S::Url; + type Name = Unset; } ///State transition - sets the `url` field to Set pub struct SetUrl(PhantomData S>); impl sealed::Sealed for SetUrl {} impl State for SetUrl { - type Name = S::Name; type Url = Set; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Url = S::Url; + type Name = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -230,8 +230,8 @@ where impl<'a, S> PublicationBuilder<'a, S> where S: publication_state::State, - S::Name: publication_state::IsSet, S::Url: publication_state::IsSet, + S::Name: publication_state::IsSet, { /// Build the final struct pub fn build(self) -> Publication<'a> { @@ -274,7 +274,7 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -288,7 +288,7 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "basicTheme", @@ -378,7 +378,7 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "showInDiscover", @@ -410,7 +410,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Publication<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 3000usize { @@ -506,7 +506,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Preferences<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/site_standard/theme/basic.rs b/crates/weaver-api/src/site_standard/theme/basic.rs index c205423..67c916c 100644 --- a/crates/weaver-api/src/site_standard/theme/basic.rs +++ b/crates/weaver-api/src/site_standard/theme/basic.rs @@ -37,67 +37,67 @@ pub mod basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AccentForeground; type Background; - type Accent; type Foreground; + type AccentForeground; + type Accent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AccentForeground = Unset; type Background = Unset; - type Accent = Unset; type Foreground = Unset; - } - ///State transition - sets the `accent_foreground` field to Set - pub struct SetAccentForeground(PhantomData S>); - impl sealed::Sealed for SetAccentForeground {} - impl State for SetAccentForeground { - type AccentForeground = Set; - type Background = S::Background; - type Accent = S::Accent; - type Foreground = S::Foreground; + type AccentForeground = Unset; + type Accent = Unset; } ///State transition - sets the `background` field to Set pub struct SetBackground(PhantomData S>); impl sealed::Sealed for SetBackground {} impl State for SetBackground { - type AccentForeground = S::AccentForeground; type Background = Set; - type Accent = S::Accent; type Foreground = S::Foreground; - } - ///State transition - sets the `accent` field to Set - pub struct SetAccent(PhantomData S>); - impl sealed::Sealed for SetAccent {} - impl State for SetAccent { type AccentForeground = S::AccentForeground; - type Background = S::Background; - type Accent = Set; - type Foreground = S::Foreground; + type Accent = S::Accent; } ///State transition - sets the `foreground` field to Set pub struct SetForeground(PhantomData S>); impl sealed::Sealed for SetForeground {} impl State for SetForeground { + type Background = S::Background; + type Foreground = Set; type AccentForeground = S::AccentForeground; + type Accent = S::Accent; + } + ///State transition - sets the `accent_foreground` field to Set + pub struct SetAccentForeground(PhantomData S>); + impl sealed::Sealed for SetAccentForeground {} + impl State for SetAccentForeground { type Background = S::Background; + type Foreground = S::Foreground; + type AccentForeground = Set; type Accent = S::Accent; - type Foreground = Set; + } + ///State transition - sets the `accent` field to Set + pub struct SetAccent(PhantomData S>); + impl sealed::Sealed for SetAccent {} + impl State for SetAccent { + type Background = S::Background; + type Foreground = S::Foreground; + type AccentForeground = S::AccentForeground; + type Accent = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `accent_foreground` field - pub struct accent_foreground(()); ///Marker type for the `background` field pub struct background(()); - ///Marker type for the `accent` field - pub struct accent(()); ///Marker type for the `foreground` field pub struct foreground(()); + ///Marker type for the `accent_foreground` field + pub struct accent_foreground(()); + ///Marker type for the `accent` field + pub struct accent(()); } } @@ -210,10 +210,10 @@ where impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, - S::AccentForeground: basic_state::IsSet, S::Background: basic_state::IsSet, - S::Accent: basic_state::IsSet, S::Foreground: basic_state::IsSet, + S::AccentForeground: basic_state::IsSet, + S::Accent: basic_state::IsSet, { /// Build the final struct pub fn build(self) -> Basic<'a> { @@ -252,7 +252,7 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -268,7 +268,7 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -336,7 +336,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Basic<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/site_standard/theme/color.rs b/crates/weaver-api/src/site_standard/theme/color.rs index 35f7875..66cf485 100644 --- a/crates/weaver-api/src/site_standard/theme/color.rs +++ b/crates/weaver-api/src/site_standard/theme/color.rs @@ -199,7 +199,7 @@ fn lexicon_doc_site_standard_theme_color() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rgb"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -214,7 +214,7 @@ fn lexicon_doc_site_standard_theme_color() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("b"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -267,7 +267,7 @@ fn lexicon_doc_site_standard_theme_color() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("a"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -333,7 +333,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Rgb<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.b; if *value > 255i64 { @@ -438,67 +438,67 @@ pub mod rgba_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type B; + type A; type R; + type B; type G; - type A; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type B = Unset; + type A = Unset; type R = Unset; + type B = Unset; type G = Unset; - type A = Unset; } - ///State transition - sets the `b` field to Set - pub struct SetB(PhantomData S>); - impl sealed::Sealed for SetB {} - impl State for SetB { - type B = Set; + ///State transition - sets the `a` field to Set + pub struct SetA(PhantomData S>); + impl sealed::Sealed for SetA {} + impl State for SetA { + type A = Set; type R = S::R; + type B = S::B; type G = S::G; - type A = S::A; } ///State transition - sets the `r` field to Set pub struct SetR(PhantomData S>); impl sealed::Sealed for SetR {} impl State for SetR { - type B = S::B; + type A = S::A; type R = Set; + type B = S::B; type G = S::G; + } + ///State transition - sets the `b` field to Set + pub struct SetB(PhantomData S>); + impl sealed::Sealed for SetB {} + impl State for SetB { type A = S::A; + type R = S::R; + type B = Set; + type G = S::G; } ///State transition - sets the `g` field to Set pub struct SetG(PhantomData S>); impl sealed::Sealed for SetG {} impl State for SetG { - type B = S::B; - type R = S::R; - type G = Set; type A = S::A; - } - ///State transition - sets the `a` field to Set - pub struct SetA(PhantomData S>); - impl sealed::Sealed for SetA {} - impl State for SetA { - type B = S::B; type R = S::R; - type G = S::G; - type A = Set; + type B = S::B; + type G = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `b` field - pub struct b(()); + ///Marker type for the `a` field + pub struct a(()); ///Marker type for the `r` field pub struct r(()); + ///Marker type for the `b` field + pub struct b(()); ///Marker type for the `g` field pub struct g(()); - ///Marker type for the `a` field - pub struct a(()); } } @@ -599,10 +599,10 @@ where impl<'a, S> RgbaBuilder<'a, S> where S: rgba_state::State, - S::B: rgba_state::IsSet, + S::A: rgba_state::IsSet, S::R: rgba_state::IsSet, + S::B: rgba_state::IsSet, S::G: rgba_state::IsSet, - S::A: rgba_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgba<'a> { @@ -644,7 +644,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Rgba<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.a; if *value > 100i64 { diff --git a/crates/weaver-api/src/tools_ozone/communication.rs b/crates/weaver-api/src/tools_ozone/communication.rs index b6627a1..b70a78f 100644 --- a/crates/weaver-api/src/tools_ozone/communication.rs +++ b/crates/weaver-api/src/tools_ozone/communication.rs @@ -55,127 +55,127 @@ pub mod template_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type ContentMarkdown; - type Disabled; - type Name; type Id; type LastUpdatedBy; type UpdatedAt; - type CreatedAt; + type Name; + type Disabled; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type ContentMarkdown = Unset; - type Disabled = Unset; - type Name = Unset; type Id = Unset; type LastUpdatedBy = Unset; type UpdatedAt = Unset; - type CreatedAt = Unset; + type Name = Unset; + type Disabled = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type CreatedAt = Set; + type ContentMarkdown = S::ContentMarkdown; + type Id = S::Id; + type LastUpdatedBy = S::LastUpdatedBy; + type UpdatedAt = S::UpdatedAt; + type Name = S::Name; + type Disabled = S::Disabled; } ///State transition - sets the `content_markdown` field to Set pub struct SetContentMarkdown(PhantomData S>); impl sealed::Sealed for SetContentMarkdown {} impl State for SetContentMarkdown { + type CreatedAt = S::CreatedAt; type ContentMarkdown = Set; - type Disabled = S::Disabled; - type Name = S::Name; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type UpdatedAt = S::UpdatedAt; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `disabled` field to Set - pub struct SetDisabled(PhantomData S>); - impl sealed::Sealed for SetDisabled {} - impl State for SetDisabled { - type ContentMarkdown = S::ContentMarkdown; - type Disabled = Set; type Name = S::Name; - type Id = S::Id; - type LastUpdatedBy = S::LastUpdatedBy; - type UpdatedAt = S::UpdatedAt; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; - type Name = Set; - type Id = S::Id; - type LastUpdatedBy = S::LastUpdatedBy; - type UpdatedAt = S::UpdatedAt; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { + type CreatedAt = S::CreatedAt; type ContentMarkdown = S::ContentMarkdown; - type Disabled = S::Disabled; - type Name = S::Name; type Id = Set; type LastUpdatedBy = S::LastUpdatedBy; type UpdatedAt = S::UpdatedAt; - type CreatedAt = S::CreatedAt; + type Name = S::Name; + type Disabled = S::Disabled; } ///State transition - sets the `last_updated_by` field to Set pub struct SetLastUpdatedBy(PhantomData S>); impl sealed::Sealed for SetLastUpdatedBy {} impl State for SetLastUpdatedBy { + type CreatedAt = S::CreatedAt; type ContentMarkdown = S::ContentMarkdown; - type Disabled = S::Disabled; - type Name = S::Name; type Id = S::Id; type LastUpdatedBy = Set; type UpdatedAt = S::UpdatedAt; - type CreatedAt = S::CreatedAt; + type Name = S::Name; + type Disabled = S::Disabled; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt(PhantomData S>); impl sealed::Sealed for SetUpdatedAt {} impl State for SetUpdatedAt { + type CreatedAt = S::CreatedAt; type ContentMarkdown = S::ContentMarkdown; - type Disabled = S::Disabled; - type Name = S::Name; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type UpdatedAt = Set; - type CreatedAt = S::CreatedAt; + type Name = S::Name; + type Disabled = S::Disabled; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type CreatedAt = S::CreatedAt; type ContentMarkdown = S::ContentMarkdown; + type Id = S::Id; + type LastUpdatedBy = S::LastUpdatedBy; + type UpdatedAt = S::UpdatedAt; + type Name = Set; type Disabled = S::Disabled; - type Name = S::Name; + } + ///State transition - sets the `disabled` field to Set + pub struct SetDisabled(PhantomData S>); + impl sealed::Sealed for SetDisabled {} + impl State for SetDisabled { + type CreatedAt = S::CreatedAt; + type ContentMarkdown = S::ContentMarkdown; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type UpdatedAt = S::UpdatedAt; - type CreatedAt = Set; + type Name = S::Name; + type Disabled = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `content_markdown` field pub struct content_markdown(()); - ///Marker type for the `disabled` field - pub struct disabled(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `last_updated_by` field pub struct last_updated_by(()); ///Marker type for the `updated_at` field pub struct updated_at(()); - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `disabled` field + pub struct disabled(()); } } @@ -395,13 +395,13 @@ where impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, + S::CreatedAt: template_view_state::IsSet, S::ContentMarkdown: template_view_state::IsSet, - S::Disabled: template_view_state::IsSet, - S::Name: template_view_state::IsSet, S::Id: template_view_state::IsSet, S::LastUpdatedBy: template_view_state::IsSet, S::UpdatedAt: template_view_state::IsSet, - S::CreatedAt: template_view_state::IsSet, + S::Name: template_view_state::IsSet, + S::Disabled: template_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TemplateView<'a> { @@ -450,7 +450,7 @@ fn lexicon_doc_tools_ozone_communication_defs() -> ::jacquard_lexicon::lexicon:: revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("templateView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -469,7 +469,7 @@ fn lexicon_doc_tools_ozone_communication_defs() -> ::jacquard_lexicon::lexicon:: nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "contentMarkdown", @@ -653,7 +653,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TemplateView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/communication/create_template.rs b/crates/weaver-api/src/tools_ozone/communication/create_template.rs index 854aede..fefca2b 100644 --- a/crates/weaver-api/src/tools_ozone/communication/create_template.rs +++ b/crates/weaver-api/src/tools_ozone/communication/create_template.rs @@ -72,8 +72,8 @@ pub enum CreateTemplateError<'a> { DuplicateTemplateName(std::option::Option>), } -impl std::fmt::Display for CreateTemplateError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for CreateTemplateError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::DuplicateTemplateName(msg) => { write!(f, "DuplicateTemplateName")?; diff --git a/crates/weaver-api/src/tools_ozone/communication/update_template.rs b/crates/weaver-api/src/tools_ozone/communication/update_template.rs index ba353ae..c802471 100644 --- a/crates/weaver-api/src/tools_ozone/communication/update_template.rs +++ b/crates/weaver-api/src/tools_ozone/communication/update_template.rs @@ -80,8 +80,8 @@ pub enum UpdateTemplateError<'a> { DuplicateTemplateName(std::option::Option>), } -impl std::fmt::Display for UpdateTemplateError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for UpdateTemplateError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::DuplicateTemplateName(msg) => { write!(f, "DuplicateTemplateName")?; diff --git a/crates/weaver-api/src/tools_ozone/hosting/get_account_history.rs b/crates/weaver-api/src/tools_ozone/hosting/get_account_history.rs index 68a3969..03a302d 100644 --- a/crates/weaver-api/src/tools_ozone/hosting/get_account_history.rs +++ b/crates/weaver-api/src/tools_ozone/hosting/get_account_history.rs @@ -37,7 +37,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accountCreated"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -46,7 +46,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("email"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -93,7 +93,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("email"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -123,7 +123,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("email"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -157,7 +157,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -222,7 +222,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("handle"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -258,7 +258,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -338,7 +338,7 @@ fn lexicon_doc_tools_ozone_hosting_getAccountHistory() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map }, }), @@ -360,7 +360,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountCreated<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -394,7 +394,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EmailConfirmed<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -428,7 +428,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EmailUpdated<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -462,51 +462,51 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Details; type CreatedBy; type CreatedAt; + type Details; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Details = Unset; type CreatedBy = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `details` field to Set - pub struct SetDetails(PhantomData S>); - impl sealed::Sealed for SetDetails {} - impl State for SetDetails { - type Details = Set; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; + type Details = Unset; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { - type Details = S::Details; type CreatedBy = Set; type CreatedAt = S::CreatedAt; + type Details = S::Details; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Details = S::Details; type CreatedBy = S::CreatedBy; type CreatedAt = Set; + type Details = S::Details; + } + ///State transition - sets the `details` field to Set + pub struct SetDetails(PhantomData S>); + impl sealed::Sealed for SetDetails {} + impl State for SetDetails { + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Details = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `details` field - pub struct details(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `details` field + pub struct details(()); } } @@ -599,9 +599,9 @@ where impl<'a, S> EventBuilder<'a, S> where S: event_state::State, - S::Details: event_state::IsSet, S::CreatedBy: event_state::IsSet, S::CreatedAt: event_state::IsSet, + S::Details: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { @@ -676,7 +676,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -814,7 +814,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HandleUpdated<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1058,7 +1058,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PasswordUpdated<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/moderation.rs b/crates/weaver-api/src/tools_ozone/moderation.rs index fe21e6e..b72c7c2 100644 --- a/crates/weaver-api/src/tools_ozone/moderation.rs +++ b/crates/weaver-api/src/tools_ozone/moderation.rs @@ -41,7 +41,7 @@ pub struct AccountEvent<'a> { pub comment: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub status: std::option::Option>, + pub status: std::option::Option>, pub timestamp: jacquard_common::types::string::Datetime, } @@ -95,7 +95,7 @@ pub struct AccountEventBuilder<'a, S: account_event_state::State> { __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -156,15 +156,12 @@ impl<'a, S: account_event_state::State> AccountEventBuilder<'a, S> { impl<'a, S: account_event_state::State> AccountEventBuilder<'a, S> { /// Set the `status` field (optional) - pub fn status( - mut self, - value: impl Into>>, - ) -> Self { + pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `status` field to an Option value (optional) - pub fn maybe_status(mut self, value: Option>) -> Self { + pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } @@ -223,6 +220,114 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AccountEventStatus<'a> { + Unknown, + Deactivated, + Deleted, + Takendown, + Suspended, + Tombstoned, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AccountEventStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::Deactivated => "deactivated", + Self::Deleted => "deleted", + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Tombstoned => "tombstoned", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AccountEventStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "deactivated" => Self::Deactivated, + "deleted" => Self::Deleted, + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "tombstoned" => Self::Tombstoned, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AccountEventStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "deactivated" => Self::Deactivated, + "deleted" => Self::Deleted, + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "tombstoned" => Self::Tombstoned, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AccountEventStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AccountEventStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AccountEventStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AccountEventStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AccountEventStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AccountEventStatus<'_> { + type Output = AccountEventStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AccountEventStatus::Unknown => AccountEventStatus::Unknown, + AccountEventStatus::Deactivated => AccountEventStatus::Deactivated, + AccountEventStatus::Deleted => AccountEventStatus::Deleted, + AccountEventStatus::Takendown => AccountEventStatus::Takendown, + AccountEventStatus::Suspended => AccountEventStatus::Suspended, + AccountEventStatus::Tombstoned => AccountEventStatus::Tombstoned, + AccountEventStatus::Other(v) => AccountEventStatus::Other(v.into_static()), + } + } +} + fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -232,7 +337,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accountEvent"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -250,7 +355,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("active"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { @@ -322,7 +427,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -449,7 +554,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "appealCount", @@ -531,7 +636,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "activeStrikeCount", @@ -626,7 +731,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -844,7 +949,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("access"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -911,7 +1016,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1012,7 +1117,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1048,7 +1153,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1144,7 +1249,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -1179,7 +1284,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acknowledgeAccountSubjects", @@ -1221,7 +1326,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1261,7 +1366,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1297,7 +1402,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1460,7 +1565,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1497,7 +1602,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1590,7 +1695,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1635,7 +1740,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1684,7 +1789,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1729,7 +1834,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1784,7 +1889,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1822,7 +1927,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -1921,7 +2026,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("add"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -2005,7 +2110,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acknowledgeAccountSubjects", @@ -2167,7 +2272,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -2205,7 +2310,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -2246,7 +2351,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -2425,7 +2530,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -2560,7 +2665,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("meta"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { @@ -2598,7 +2703,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "subjectStatus", @@ -2622,7 +2727,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "subjectStatus", @@ -2655,7 +2760,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -2736,7 +2841,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -2831,7 +2936,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobCids"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -2951,7 +3056,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blobs"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -3069,7 +3174,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -3103,7 +3208,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "appealedCount", @@ -3228,7 +3333,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "deactivatedAt", @@ -3412,7 +3517,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "deactivatedAt", @@ -3639,7 +3744,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -3681,7 +3786,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accountReportCount", @@ -3847,7 +3952,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -3885,7 +3990,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -3983,7 +4088,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -4302,7 +4407,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accountStats", @@ -4738,7 +4843,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("profile"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -4840,7 +4945,7 @@ fn lexicon_doc_tools_ozone_moderation_defs() -> ::jacquard_lexicon::lexicon::Lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -4895,7 +5000,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4922,11 +5027,116 @@ pub struct AccountHosting<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub reactivated_at: std::option::Option, #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: AccountHostingStatus<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AccountHostingStatus<'a> { + Takendown, + Suspended, + Deleted, + Deactivated, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AccountHostingStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takendown => "takendown", + Self::Suspended => "suspended", + Self::Deleted => "deleted", + Self::Deactivated => "deactivated", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AccountHostingStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AccountHostingStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takendown" => Self::Takendown, + "suspended" => Self::Suspended, + "deleted" => Self::Deleted, + "deactivated" => Self::Deactivated, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AccountHostingStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AccountHostingStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AccountHostingStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AccountHostingStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AccountHostingStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AccountHostingStatus<'_> { + type Output = AccountHostingStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AccountHostingStatus::Takendown => AccountHostingStatus::Takendown, + AccountHostingStatus::Suspended => AccountHostingStatus::Suspended, + AccountHostingStatus::Deleted => AccountHostingStatus::Deleted, + AccountHostingStatus::Deactivated => AccountHostingStatus::Deactivated, + AccountHostingStatus::Unknown => AccountHostingStatus::Unknown, + AccountHostingStatus::Other(v) => { + AccountHostingStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountHosting<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.defs" @@ -4939,7 +5149,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountHosting<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -4987,7 +5197,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountStats<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5032,7 +5242,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AccountStrike<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5084,7 +5294,7 @@ pub struct AgeAssuranceEvent<'a> { pub region_code: std::option::Option>, /// The status of the Age Assurance process. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: AgeAssuranceEventStatus<'a>, } pub mod age_assurance_event_state { @@ -5097,51 +5307,51 @@ pub mod age_assurance_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Status; type AttemptId; + type Status; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Status = Unset; type AttemptId = Unset; + type Status = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `attempt_id` field to Set + pub struct SetAttemptId(PhantomData S>); + impl sealed::Sealed for SetAttemptId {} + impl State for SetAttemptId { + type AttemptId = Set; type Status = S::Status; - type AttemptId = S::AttemptId; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { - type CreatedAt = S::CreatedAt; - type Status = Set; type AttemptId = S::AttemptId; - } - ///State transition - sets the `attempt_id` field to Set - pub struct SetAttemptId(PhantomData S>); - impl sealed::Sealed for SetAttemptId {} - impl State for SetAttemptId { + type Status = Set; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type AttemptId = S::AttemptId; type Status = S::Status; - type AttemptId = Set; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `attempt_id` field pub struct attempt_id(()); + ///Marker type for the `status` field + pub struct status(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -5158,7 +5368,7 @@ pub struct AgeAssuranceEventBuilder<'a, S: age_assurance_event_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -5365,7 +5575,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> AgeAssuranceEventBuilder<'a, age_assurance_event_state::SetStatus> { self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); AgeAssuranceEventBuilder { @@ -5379,9 +5589,9 @@ where impl<'a, S> AgeAssuranceEventBuilder<'a, S> where S: age_assurance_event_state::State, - S::CreatedAt: age_assurance_event_state::IsSet, - S::Status: age_assurance_event_state::IsSet, S::AttemptId: age_assurance_event_state::IsSet, + S::Status: age_assurance_event_state::IsSet, + S::CreatedAt: age_assurance_event_state::IsSet, { /// Build the final struct pub fn build(self) -> AgeAssuranceEvent<'a> { @@ -5423,6 +5633,102 @@ where } } +/// The status of the Age Assurance process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AgeAssuranceEventStatus<'a> { + Unknown, + Pending, + Assured, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AgeAssuranceEventStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Unknown => "unknown", + Self::Pending => "pending", + Self::Assured => "assured", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AgeAssuranceEventStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AgeAssuranceEventStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "unknown" => Self::Unknown, + "pending" => Self::Pending, + "assured" => Self::Assured, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AgeAssuranceEventStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AgeAssuranceEventStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AgeAssuranceEventStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AgeAssuranceEventStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AgeAssuranceEventStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AgeAssuranceEventStatus<'_> { + type Output = AgeAssuranceEventStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AgeAssuranceEventStatus::Unknown => AgeAssuranceEventStatus::Unknown, + AgeAssuranceEventStatus::Pending => AgeAssuranceEventStatus::Pending, + AgeAssuranceEventStatus::Assured => AgeAssuranceEventStatus::Assured, + AgeAssuranceEventStatus::Other(v) => { + AgeAssuranceEventStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceEvent<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.defs" @@ -5435,7 +5741,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5462,22 +5768,124 @@ pub struct AgeAssuranceOverrideEvent<'a> { pub comment: jacquard_common::CowStr<'a>, /// The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state. #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: AgeAssuranceOverrideEventStatus<'a>, } -impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceOverrideEvent<'a> { - fn nsid() -> &'static str { - "tools.ozone.moderation.defs" +/// The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AgeAssuranceOverrideEventStatus<'a> { + Assured, + Reset, + Blocked, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AgeAssuranceOverrideEventStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Assured => "assured", + Self::Reset => "reset", + Self::Blocked => "blocked", + Self::Other(s) => s.as_ref(), + } } - fn def_name() -> &'static str { - "ageAssuranceOverrideEvent" +} + +impl<'a> From<&'a str> for AgeAssuranceOverrideEventStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "assured" => Self::Assured, + "reset" => Self::Reset, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AgeAssuranceOverrideEventStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "assured" => Self::Assured, + "reset" => Self::Reset, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AgeAssuranceOverrideEventStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AgeAssuranceOverrideEventStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AgeAssuranceOverrideEventStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AgeAssuranceOverrideEventStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AgeAssuranceOverrideEventStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AgeAssuranceOverrideEventStatus<'_> { + type Output = AgeAssuranceOverrideEventStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + AgeAssuranceOverrideEventStatus::Assured => { + AgeAssuranceOverrideEventStatus::Assured + } + AgeAssuranceOverrideEventStatus::Reset => { + AgeAssuranceOverrideEventStatus::Reset + } + AgeAssuranceOverrideEventStatus::Blocked => { + AgeAssuranceOverrideEventStatus::Blocked + } + AgeAssuranceOverrideEventStatus::Other(v) => { + AgeAssuranceOverrideEventStatus::Other(v.into_static()) + } + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AgeAssuranceOverrideEvent<'a> { + fn nsid() -> &'static str { + "tools.ozone.moderation.defs" + } + fn def_name() -> &'static str { + "ageAssuranceOverrideEvent" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_moderation_defs() } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5518,67 +5926,67 @@ pub mod blob_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type MimeType; type Cid; - type CreatedAt; + type MimeType; type Size; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type MimeType = Unset; type Cid = Unset; - type CreatedAt = Unset; + type MimeType = Unset; type Size = Unset; - } - ///State transition - sets the `mime_type` field to Set - pub struct SetMimeType(PhantomData S>); - impl sealed::Sealed for SetMimeType {} - impl State for SetMimeType { - type MimeType = Set; - type Cid = S::Cid; - type CreatedAt = S::CreatedAt; - type Size = S::Size; + type CreatedAt = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { - type MimeType = S::MimeType; type Cid = Set; - type CreatedAt = S::CreatedAt; + type MimeType = S::MimeType; type Size = S::Size; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type MimeType = S::MimeType; + ///State transition - sets the `mime_type` field to Set + pub struct SetMimeType(PhantomData S>); + impl sealed::Sealed for SetMimeType {} + impl State for SetMimeType { type Cid = S::Cid; - type CreatedAt = Set; + type MimeType = Set; type Size = S::Size; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `size` field to Set pub struct SetSize(PhantomData S>); impl sealed::Sealed for SetSize {} impl State for SetSize { - type MimeType = S::MimeType; type Cid = S::Cid; - type CreatedAt = S::CreatedAt; + type MimeType = S::MimeType; type Size = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Cid = S::Cid; + type MimeType = S::MimeType; + type Size = S::Size; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `mime_type` field - pub struct mime_type(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `mime_type` field + pub struct mime_type(()); ///Marker type for the `size` field pub struct size(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -5725,10 +6133,10 @@ where impl<'a, S> BlobViewBuilder<'a, S> where S: blob_view_state::State, - S::MimeType: blob_view_state::IsSet, S::Cid: blob_view_state::IsSet, - S::CreatedAt: blob_view_state::IsSet, + S::MimeType: blob_view_state::IsSet, S::Size: blob_view_state::IsSet, + S::CreatedAt: blob_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BlobView<'a> { @@ -5793,7 +6201,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlobView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -5829,7 +6237,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CancelScheduledTakedownEv } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6057,7 +6465,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for IdentityEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6227,7 +6635,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ImageDetails<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6265,7 +6673,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventAcknowledge<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6304,7 +6712,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventComment<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6340,7 +6748,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventDivert<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6401,7 +6809,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventEmail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.policies { #[allow(unused_comparisons)] if value.len() > 5usize { @@ -6448,7 +6856,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventEscalate<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6665,7 +7073,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventLabel<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6826,7 +7234,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventMute<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -6865,7 +7273,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventMuteReporter<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7028,7 +7436,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventPriorityScore<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.score; if *value > 100i64 { @@ -7232,7 +7640,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventReport<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7269,7 +7677,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventResolveAppeal<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7317,7 +7725,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventReverseTakedown<' } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.policies { #[allow(unused_comparisons)] if value.len() > 5usize { @@ -7530,7 +7938,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventTag<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7590,7 +7998,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventTakedown<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.policies { #[allow(unused_comparisons)] if value.len() > 5usize { @@ -7639,7 +8047,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventUnmute<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7676,7 +8084,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventUnmuteReporter<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -7724,105 +8132,105 @@ pub mod mod_event_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Subject; type Event; - type CreatedBy; - type Id; + type Subject; type SubjectBlobCids; + type Id; + type CreatedAt; + type CreatedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Subject = Unset; type Event = Unset; - type CreatedBy = Unset; - type Id = Unset; + type Subject = Unset; type SubjectBlobCids = Unset; + type Id = Unset; + type CreatedAt = Unset; + type CreatedBy = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `event` field to Set + pub struct SetEvent(PhantomData S>); + impl sealed::Sealed for SetEvent {} + impl State for SetEvent { + type Event = Set; type Subject = S::Subject; - type Event = S::Event; - type CreatedBy = S::CreatedBy; - type Id = S::Id; type SubjectBlobCids = S::SubjectBlobCids; + type Id = S::Id; + type CreatedAt = S::CreatedAt; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type CreatedAt = S::CreatedAt; - type Subject = Set; type Event = S::Event; - type CreatedBy = S::CreatedBy; - type Id = S::Id; + type Subject = Set; type SubjectBlobCids = S::SubjectBlobCids; - } - ///State transition - sets the `event` field to Set - pub struct SetEvent(PhantomData S>); - impl sealed::Sealed for SetEvent {} - impl State for SetEvent { + type Id = S::Id; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type Event = Set; type CreatedBy = S::CreatedBy; - type Id = S::Id; - type SubjectBlobCids = S::SubjectBlobCids; } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy(PhantomData S>); - impl sealed::Sealed for SetCreatedBy {} - impl State for SetCreatedBy { - type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + ///State transition - sets the `subject_blob_cids` field to Set + pub struct SetSubjectBlobCids(PhantomData S>); + impl sealed::Sealed for SetSubjectBlobCids {} + impl State for SetSubjectBlobCids { type Event = S::Event; - type CreatedBy = Set; + type Subject = S::Subject; + type SubjectBlobCids = Set; type Id = S::Id; - type SubjectBlobCids = S::SubjectBlobCids; + type CreatedAt = S::CreatedAt; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { - type CreatedAt = S::CreatedAt; - type Subject = S::Subject; type Event = S::Event; - type CreatedBy = S::CreatedBy; - type Id = Set; + type Subject = S::Subject; type SubjectBlobCids = S::SubjectBlobCids; - } - ///State transition - sets the `subject_blob_cids` field to Set - pub struct SetSubjectBlobCids(PhantomData S>); - impl sealed::Sealed for SetSubjectBlobCids {} - impl State for SetSubjectBlobCids { + type Id = Set; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { type Event = S::Event; + type Subject = S::Subject; + type SubjectBlobCids = S::SubjectBlobCids; + type Id = S::Id; + type CreatedAt = Set; type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy(PhantomData S>); + impl sealed::Sealed for SetCreatedBy {} + impl State for SetCreatedBy { + type Event = S::Event; + type Subject = S::Subject; + type SubjectBlobCids = S::SubjectBlobCids; type Id = S::Id; - type SubjectBlobCids = Set; + type CreatedAt = S::CreatedAt; + type CreatedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `event` field pub struct event(()); - ///Marker type for the `created_by` field - pub struct created_by(()); - ///Marker type for the `id` field - pub struct id(()); + ///Marker type for the `subject` field + pub struct subject(()); ///Marker type for the `subject_blob_cids` field pub struct subject_blob_cids(()); + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `created_by` field + pub struct created_by(()); } } @@ -8045,12 +8453,12 @@ impl<'a, S: mod_event_view_state::State> ModEventViewBuilder<'a, S> { impl<'a, S> ModEventViewBuilder<'a, S> where S: mod_event_view_state::State, - S::CreatedAt: mod_event_view_state::IsSet, - S::Subject: mod_event_view_state::IsSet, S::Event: mod_event_view_state::IsSet, - S::CreatedBy: mod_event_view_state::IsSet, - S::Id: mod_event_view_state::IsSet, + S::Subject: mod_event_view_state::IsSet, S::SubjectBlobCids: mod_event_view_state::IsSet, + S::Id: mod_event_view_state::IsSet, + S::CreatedAt: mod_event_view_state::IsSet, + S::CreatedBy: mod_event_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventView<'a> { @@ -8202,7 +8610,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -8244,105 +8652,105 @@ pub mod mod_event_view_detail_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SubjectBlobs; + type Subject; type Event; type Id; - type CreatedBy; + type SubjectBlobs; type CreatedAt; - type Subject; + type CreatedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SubjectBlobs = Unset; + type Subject = Unset; type Event = Unset; type Id = Unset; - type CreatedBy = Unset; + type SubjectBlobs = Unset; type CreatedAt = Unset; - type Subject = Unset; + type CreatedBy = Unset; } - ///State transition - sets the `subject_blobs` field to Set - pub struct SetSubjectBlobs(PhantomData S>); - impl sealed::Sealed for SetSubjectBlobs {} - impl State for SetSubjectBlobs { - type SubjectBlobs = Set; + ///State transition - sets the `subject` field to Set + pub struct SetSubject(PhantomData S>); + impl sealed::Sealed for SetSubject {} + impl State for SetSubject { + type Subject = Set; type Event = S::Event; type Id = S::Id; - type CreatedBy = S::CreatedBy; + type SubjectBlobs = S::SubjectBlobs; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `event` field to Set pub struct SetEvent(PhantomData S>); impl sealed::Sealed for SetEvent {} impl State for SetEvent { - type SubjectBlobs = S::SubjectBlobs; + type Subject = S::Subject; type Event = Set; type Id = S::Id; - type CreatedBy = S::CreatedBy; + type SubjectBlobs = S::SubjectBlobs; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { - type SubjectBlobs = S::SubjectBlobs; + type Subject = S::Subject; type Event = S::Event; type Id = Set; - type CreatedBy = S::CreatedBy; + type SubjectBlobs = S::SubjectBlobs; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy(PhantomData S>); - impl sealed::Sealed for SetCreatedBy {} - impl State for SetCreatedBy { - type SubjectBlobs = S::SubjectBlobs; + ///State transition - sets the `subject_blobs` field to Set + pub struct SetSubjectBlobs(PhantomData S>); + impl sealed::Sealed for SetSubjectBlobs {} + impl State for SetSubjectBlobs { + type Subject = S::Subject; type Event = S::Event; type Id = S::Id; - type CreatedBy = Set; + type SubjectBlobs = Set; type CreatedAt = S::CreatedAt; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type SubjectBlobs = S::SubjectBlobs; + type Subject = S::Subject; type Event = S::Event; type Id = S::Id; - type CreatedBy = S::CreatedBy; + type SubjectBlobs = S::SubjectBlobs; type CreatedAt = Set; - type Subject = S::Subject; + type CreatedBy = S::CreatedBy; } - ///State transition - sets the `subject` field to Set - pub struct SetSubject(PhantomData S>); - impl sealed::Sealed for SetSubject {} - impl State for SetSubject { - type SubjectBlobs = S::SubjectBlobs; + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy(PhantomData S>); + impl sealed::Sealed for SetCreatedBy {} + impl State for SetCreatedBy { + type Subject = S::Subject; type Event = S::Event; type Id = S::Id; - type CreatedBy = S::CreatedBy; + type SubjectBlobs = S::SubjectBlobs; type CreatedAt = S::CreatedAt; - type Subject = Set; + type CreatedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject_blobs` field - pub struct subject_blobs(()); + ///Marker type for the `subject` field + pub struct subject(()); ///Marker type for the `event` field pub struct event(()); ///Marker type for the `id` field pub struct id(()); - ///Marker type for the `created_by` field - pub struct created_by(()); + ///Marker type for the `subject_blobs` field + pub struct subject_blobs(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `subject` field - pub struct subject(()); + ///Marker type for the `created_by` field + pub struct created_by(()); } } @@ -8515,12 +8923,12 @@ where impl<'a, S> ModEventViewDetailBuilder<'a, S> where S: mod_event_view_detail_state::State, - S::SubjectBlobs: mod_event_view_detail_state::IsSet, + S::Subject: mod_event_view_detail_state::IsSet, S::Event: mod_event_view_detail_state::IsSet, S::Id: mod_event_view_detail_state::IsSet, - S::CreatedBy: mod_event_view_detail_state::IsSet, + S::SubjectBlobs: mod_event_view_detail_state::IsSet, S::CreatedAt: mod_event_view_detail_state::IsSet, - S::Subject: mod_event_view_detail_state::IsSet, + S::CreatedBy: mod_event_view_detail_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventViewDetail<'a> { @@ -8670,7 +9078,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModEventViewDetail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -8710,7 +9118,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModTool<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -8747,7 +9155,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Moderation<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -8784,7 +9192,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModerationDetail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -8809,7 +9217,7 @@ pub struct RecordEvent<'a> { #[serde(borrow)] pub comment: std::option::Option>, #[serde(borrow)] - pub op: jacquard_common::CowStr<'a>, + pub op: RecordEventOp<'a>, pub timestamp: jacquard_common::types::string::Datetime, } @@ -8823,37 +9231,37 @@ pub mod record_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Timestamp; type Op; + type Timestamp; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Timestamp = Unset; type Op = Unset; - } - ///State transition - sets the `timestamp` field to Set - pub struct SetTimestamp(PhantomData S>); - impl sealed::Sealed for SetTimestamp {} - impl State for SetTimestamp { - type Timestamp = Set; - type Op = S::Op; + type Timestamp = Unset; } ///State transition - sets the `op` field to Set pub struct SetOp(PhantomData S>); impl sealed::Sealed for SetOp {} impl State for SetOp { - type Timestamp = S::Timestamp; type Op = Set; + type Timestamp = S::Timestamp; + } + ///State transition - sets the `timestamp` field to Set + pub struct SetTimestamp(PhantomData S>); + impl sealed::Sealed for SetTimestamp {} + impl State for SetTimestamp { + type Op = S::Op; + type Timestamp = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `timestamp` field - pub struct timestamp(()); ///Marker type for the `op` field pub struct op(()); + ///Marker type for the `timestamp` field + pub struct timestamp(()); } } @@ -8863,7 +9271,7 @@ pub struct RecordEventBuilder<'a, S: record_event_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -8930,7 +9338,7 @@ where /// Set the `op` field (required) pub fn op( mut self, - value: impl Into>, + value: impl Into>, ) -> RecordEventBuilder<'a, record_event_state::SetOp> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); RecordEventBuilder { @@ -8963,8 +9371,8 @@ where impl<'a, S> RecordEventBuilder<'a, S> where S: record_event_state::State, - S::Timestamp: record_event_state::IsSet, S::Op: record_event_state::IsSet, + S::Timestamp: record_event_state::IsSet, { /// Build the final struct pub fn build(self) -> RecordEvent<'a> { @@ -8994,6 +9402,99 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RecordEventOp<'a> { + Create, + Update, + Delete, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RecordEventOp<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Create => "create", + Self::Update => "update", + Self::Delete => "delete", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RecordEventOp<'a> { + fn from(s: &'a str) -> Self { + match s { + "create" => Self::Create, + "update" => Self::Update, + "delete" => Self::Delete, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RecordEventOp<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "create" => Self::Create, + "update" => Self::Update, + "delete" => Self::Delete, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RecordEventOp<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RecordEventOp<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RecordEventOp<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RecordEventOp<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RecordEventOp<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RecordEventOp<'_> { + type Output = RecordEventOp<'static>; + fn into_static(self) -> Self::Output { + match self { + RecordEventOp::Create => RecordEventOp::Create, + RecordEventOp::Update => RecordEventOp::Update, + RecordEventOp::Delete => RecordEventOp::Delete, + RecordEventOp::Other(v) => RecordEventOp::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEvent<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.defs" @@ -9006,7 +9507,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -9029,11 +9530,99 @@ pub struct RecordHosting<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub deleted_at: std::option::Option, #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: RecordHostingStatus<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RecordHostingStatus<'a> { + Deleted, + Unknown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RecordHostingStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Deleted => "deleted", + Self::Unknown => "unknown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RecordHostingStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "deleted" => Self::Deleted, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RecordHostingStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "deleted" => Self::Deleted, + "unknown" => Self::Unknown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RecordHostingStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RecordHostingStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RecordHostingStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RecordHostingStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RecordHostingStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RecordHostingStatus<'_> { + type Output = RecordHostingStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + RecordHostingStatus::Deleted => RecordHostingStatus::Deleted, + RecordHostingStatus::Unknown => RecordHostingStatus::Unknown, + RecordHostingStatus::Other(v) => RecordHostingStatus::Other(v.into_static()), + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordHosting<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.defs" @@ -9046,7 +9635,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordHosting<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -9088,127 +9677,127 @@ pub mod record_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Cid; type Moderation; - type Value; type Repo; - type IndexedAt; - type Cid; type Uri; type BlobCids; + type IndexedAt; + type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Cid = Unset; type Moderation = Unset; - type Value = Unset; type Repo = Unset; - type IndexedAt = Unset; - type Cid = Unset; type Uri = Unset; type BlobCids = Unset; + type IndexedAt = Unset; + type Value = Unset; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Cid = Set; + type Moderation = S::Moderation; + type Repo = S::Repo; + type Uri = S::Uri; + type BlobCids = S::BlobCids; + type IndexedAt = S::IndexedAt; + type Value = S::Value; } ///State transition - sets the `moderation` field to Set pub struct SetModeration(PhantomData S>); impl sealed::Sealed for SetModeration {} impl State for SetModeration { + type Cid = S::Cid; type Moderation = Set; - type Value = S::Value; type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; type Uri = S::Uri; type BlobCids = S::BlobCids; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { - type Moderation = S::Moderation; - type Value = Set; - type Repo = S::Repo; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; - type Uri = S::Uri; - type BlobCids = S::BlobCids; + type Value = S::Value; } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData S>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { - type Moderation = S::Moderation; - type Value = S::Value; - type Repo = Set; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type Uri = S::Uri; - type BlobCids = S::BlobCids; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { type Moderation = S::Moderation; - type Value = S::Value; - type Repo = S::Repo; - type IndexedAt = Set; - type Cid = S::Cid; + type Repo = Set; type Uri = S::Uri; type BlobCids = S::BlobCids; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Moderation = S::Moderation; - type Value = S::Value; - type Repo = S::Repo; type IndexedAt = S::IndexedAt; - type Cid = Set; - type Uri = S::Uri; - type BlobCids = S::BlobCids; + type Value = S::Value; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { + type Cid = S::Cid; type Moderation = S::Moderation; - type Value = S::Value; type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; type Uri = Set; type BlobCids = S::BlobCids; + type IndexedAt = S::IndexedAt; + type Value = S::Value; } ///State transition - sets the `blob_cids` field to Set pub struct SetBlobCids(PhantomData S>); impl sealed::Sealed for SetBlobCids {} impl State for SetBlobCids { + type Cid = S::Cid; type Moderation = S::Moderation; - type Value = S::Value; type Repo = S::Repo; + type Uri = S::Uri; + type BlobCids = Set; type IndexedAt = S::IndexedAt; + type Value = S::Value; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { type Cid = S::Cid; + type Moderation = S::Moderation; + type Repo = S::Repo; type Uri = S::Uri; - type BlobCids = Set; + type BlobCids = S::BlobCids; + type IndexedAt = Set; + type Value = S::Value; + } + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Cid = S::Cid; + type Moderation = S::Moderation; + type Repo = S::Repo; + type Uri = S::Uri; + type BlobCids = S::BlobCids; + type IndexedAt = S::IndexedAt; + type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `moderation` field pub struct moderation(()); - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `repo` field pub struct repo(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `blob_cids` field pub struct blob_cids(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `value` field + pub struct value(()); } } @@ -9381,13 +9970,13 @@ where impl<'a, S> RecordViewBuilder<'a, S> where S: record_view_state::State, + S::Cid: record_view_state::IsSet, S::Moderation: record_view_state::IsSet, - S::Value: record_view_state::IsSet, S::Repo: record_view_state::IsSet, - S::IndexedAt: record_view_state::IsSet, - S::Cid: record_view_state::IsSet, S::Uri: record_view_state::IsSet, S::BlobCids: record_view_state::IsSet, + S::IndexedAt: record_view_state::IsSet, + S::Value: record_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RecordView<'a> { @@ -9435,7 +10024,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -9480,11 +10069,11 @@ pub mod record_view_detail_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; - type Cid; type Value; - type Uri; + type Repo; type Blobs; + type Uri; + type Cid; type IndexedAt; type Moderation; } @@ -9492,47 +10081,47 @@ pub mod record_view_detail_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; - type Cid = Unset; type Value = Unset; - type Uri = Unset; + type Repo = Unset; type Blobs = Unset; + type Uri = Unset; + type Cid = Unset; type IndexedAt = Unset; type Moderation = Unset; } + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Value = Set; + type Repo = S::Repo; + type Blobs = S::Blobs; + type Uri = S::Uri; + type Cid = S::Cid; + type IndexedAt = S::IndexedAt; + type Moderation = S::Moderation; + } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData S>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { - type Repo = Set; - type Cid = S::Cid; type Value = S::Value; - type Uri = S::Uri; + type Repo = Set; type Blobs = S::Blobs; - type IndexedAt = S::IndexedAt; - type Moderation = S::Moderation; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid(PhantomData S>); - impl sealed::Sealed for SetCid {} - impl State for SetCid { - type Repo = S::Repo; - type Cid = Set; - type Value = S::Value; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { + ///State transition - sets the `blobs` field to Set + pub struct SetBlobs(PhantomData S>); + impl sealed::Sealed for SetBlobs {} + impl State for SetBlobs { + type Value = S::Value; type Repo = S::Repo; - type Cid = S::Cid; - type Value = Set; + type Blobs = Set; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; } @@ -9540,35 +10129,35 @@ pub mod record_view_detail_state { pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { - type Repo = S::Repo; - type Cid = S::Cid; type Value = S::Value; - type Uri = Set; + type Repo = S::Repo; type Blobs = S::Blobs; + type Uri = Set; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; } - ///State transition - sets the `blobs` field to Set - pub struct SetBlobs(PhantomData S>); - impl sealed::Sealed for SetBlobs {} - impl State for SetBlobs { - type Repo = S::Repo; - type Cid = S::Cid; + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData S>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { type Value = S::Value; + type Repo = S::Repo; + type Blobs = S::Blobs; type Uri = S::Uri; - type Blobs = Set; + type Cid = Set; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Repo = S::Repo; - type Cid = S::Cid; + impl State for SetIndexedAt { type Value = S::Value; - type Uri = S::Uri; + type Repo = S::Repo; type Blobs = S::Blobs; + type Uri = S::Uri; + type Cid = S::Cid; type IndexedAt = Set; type Moderation = S::Moderation; } @@ -9576,27 +10165,27 @@ pub mod record_view_detail_state { pub struct SetModeration(PhantomData S>); impl sealed::Sealed for SetModeration {} impl State for SetModeration { - type Repo = S::Repo; - type Cid = S::Cid; type Value = S::Value; - type Uri = S::Uri; + type Repo = S::Repo; type Blobs = S::Blobs; + type Uri = S::Uri; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Moderation = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `blobs` field pub struct blobs(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `moderation` field @@ -9793,11 +10382,11 @@ where impl<'a, S> RecordViewDetailBuilder<'a, S> where S: record_view_detail_state::State, - S::Repo: record_view_detail_state::IsSet, - S::Cid: record_view_detail_state::IsSet, S::Value: record_view_detail_state::IsSet, - S::Uri: record_view_detail_state::IsSet, + S::Repo: record_view_detail_state::IsSet, S::Blobs: record_view_detail_state::IsSet, + S::Uri: record_view_detail_state::IsSet, + S::Cid: record_view_detail_state::IsSet, S::IndexedAt: record_view_detail_state::IsSet, S::Moderation: record_view_detail_state::IsSet, { @@ -9849,7 +10438,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordViewDetail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -9987,7 +10576,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordViewNotFound<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -10044,7 +10633,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordsStats<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -10100,85 +10689,85 @@ pub mod repo_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Handle; type Did; + type IndexedAt; type Moderation; type RelatedRecords; - type IndexedAt; - type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Handle = Unset; type Did = Unset; + type IndexedAt = Unset; type Moderation = Unset; type RelatedRecords = Unset; - type IndexedAt = Unset; - type Handle = Unset; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle(PhantomData S>); + impl sealed::Sealed for SetHandle {} + impl State for SetHandle { + type Handle = Set; + type Did = S::Did; + type IndexedAt = S::IndexedAt; + type Moderation = S::Moderation; + type RelatedRecords = S::RelatedRecords; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { + type Handle = S::Handle; type Did = Set; + type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type RelatedRecords = S::RelatedRecords; - type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData S>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { type Handle = S::Handle; + type Did = S::Did; + type IndexedAt = Set; + type Moderation = S::Moderation; + type RelatedRecords = S::RelatedRecords; } ///State transition - sets the `moderation` field to Set pub struct SetModeration(PhantomData S>); impl sealed::Sealed for SetModeration {} impl State for SetModeration { + type Handle = S::Handle; type Did = S::Did; + type IndexedAt = S::IndexedAt; type Moderation = Set; type RelatedRecords = S::RelatedRecords; - type IndexedAt = S::IndexedAt; - type Handle = S::Handle; } ///State transition - sets the `related_records` field to Set pub struct SetRelatedRecords(PhantomData S>); impl sealed::Sealed for SetRelatedRecords {} impl State for SetRelatedRecords { - type Did = S::Did; - type Moderation = S::Moderation; - type RelatedRecords = Set; - type IndexedAt = S::IndexedAt; - type Handle = S::Handle; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt(PhantomData S>); - impl sealed::Sealed for SetIndexedAt {} - impl State for SetIndexedAt { - type Did = S::Did; - type Moderation = S::Moderation; - type RelatedRecords = S::RelatedRecords; - type IndexedAt = Set; type Handle = S::Handle; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle(PhantomData S>); - impl sealed::Sealed for SetHandle {} - impl State for SetHandle { type Did = S::Did; - type Moderation = S::Moderation; - type RelatedRecords = S::RelatedRecords; type IndexedAt = S::IndexedAt; - type Handle = Set; + type Moderation = S::Moderation; + type RelatedRecords = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `handle` field + pub struct handle(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `moderation` field pub struct moderation(()); ///Marker type for the `related_records` field pub struct related_records(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `handle` field - pub struct handle(()); } } @@ -10434,11 +11023,11 @@ impl<'a, S: repo_view_state::State> RepoViewBuilder<'a, S> { impl<'a, S> RepoViewBuilder<'a, S> where S: repo_view_state::State, + S::Handle: repo_view_state::IsSet, S::Did: repo_view_state::IsSet, + S::IndexedAt: repo_view_state::IsSet, S::Moderation: repo_view_state::IsSet, S::RelatedRecords: repo_view_state::IsSet, - S::IndexedAt: repo_view_state::IsSet, - S::Handle: repo_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RepoView<'a> { @@ -10494,7 +11083,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -10562,8 +11151,8 @@ pub mod repo_view_detail_state { pub trait State: sealed::Sealed { type RelatedRecords; type IndexedAt; - type Did; type Handle; + type Did; type Moderation; } /// Empty state - all required fields are unset @@ -10572,8 +11161,8 @@ pub mod repo_view_detail_state { impl State for Empty { type RelatedRecords = Unset; type IndexedAt = Unset; - type Did = Unset; type Handle = Unset; + type Did = Unset; type Moderation = Unset; } ///State transition - sets the `related_records` field to Set @@ -10582,8 +11171,8 @@ pub mod repo_view_detail_state { impl State for SetRelatedRecords { type RelatedRecords = Set; type IndexedAt = S::IndexedAt; - type Did = S::Did; type Handle = S::Handle; + type Did = S::Did; type Moderation = S::Moderation; } ///State transition - sets the `indexed_at` field to Set @@ -10592,18 +11181,8 @@ pub mod repo_view_detail_state { impl State for SetIndexedAt { type RelatedRecords = S::RelatedRecords; type IndexedAt = Set; - type Did = S::Did; - type Handle = S::Handle; - type Moderation = S::Moderation; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type RelatedRecords = S::RelatedRecords; - type IndexedAt = S::IndexedAt; - type Did = Set; type Handle = S::Handle; + type Did = S::Did; type Moderation = S::Moderation; } ///State transition - sets the `handle` field to Set @@ -10612,8 +11191,18 @@ pub mod repo_view_detail_state { impl State for SetHandle { type RelatedRecords = S::RelatedRecords; type IndexedAt = S::IndexedAt; - type Did = S::Did; type Handle = Set; + type Did = S::Did; + type Moderation = S::Moderation; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type RelatedRecords = S::RelatedRecords; + type IndexedAt = S::IndexedAt; + type Handle = S::Handle; + type Did = Set; type Moderation = S::Moderation; } ///State transition - sets the `moderation` field to Set @@ -10622,8 +11211,8 @@ pub mod repo_view_detail_state { impl State for SetModeration { type RelatedRecords = S::RelatedRecords; type IndexedAt = S::IndexedAt; - type Did = S::Did; type Handle = S::Handle; + type Did = S::Did; type Moderation = Set; } /// Marker types for field names @@ -10633,10 +11222,10 @@ pub mod repo_view_detail_state { pub struct related_records(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); ///Marker type for the `moderation` field pub struct moderation(()); } @@ -10959,8 +11548,8 @@ where S: repo_view_detail_state::State, S::RelatedRecords: repo_view_detail_state::IsSet, S::IndexedAt: repo_view_detail_state::IsSet, - S::Did: repo_view_detail_state::IsSet, S::Handle: repo_view_detail_state::IsSet, + S::Did: repo_view_detail_state::IsSet, S::Moderation: repo_view_detail_state::IsSet, { /// Build the final struct @@ -11023,7 +11612,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoViewDetail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -11161,7 +11750,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoViewNotFound<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -11208,175 +11797,175 @@ pub mod reporter_stats_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type LabeledAccountCount; - type Did; - type TakendownRecordCount; - type ReportedAccountCount; type ReportedRecordCount; type RecordReportCount; + type TakendownRecordCount; type TakendownAccountCount; + type ReportedAccountCount; type LabeledRecordCount; + type Did; + type LabeledAccountCount; type AccountReportCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type LabeledAccountCount = Unset; - type Did = Unset; - type TakendownRecordCount = Unset; - type ReportedAccountCount = Unset; type ReportedRecordCount = Unset; type RecordReportCount = Unset; + type TakendownRecordCount = Unset; type TakendownAccountCount = Unset; + type ReportedAccountCount = Unset; type LabeledRecordCount = Unset; + type Did = Unset; + type LabeledAccountCount = Unset; type AccountReportCount = Unset; } - ///State transition - sets the `labeled_account_count` field to Set - pub struct SetLabeledAccountCount(PhantomData S>); - impl sealed::Sealed for SetLabeledAccountCount {} - impl State for SetLabeledAccountCount { - type LabeledAccountCount = Set; - type Did = S::Did; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; + ///State transition - sets the `reported_record_count` field to Set + pub struct SetReportedRecordCount(PhantomData S>); + impl sealed::Sealed for SetReportedRecordCount {} + impl State for SetReportedRecordCount { + type ReportedRecordCount = Set; type RecordReportCount = S::RecordReportCount; + type TakendownRecordCount = S::TakendownRecordCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = S::AccountReportCount; } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = Set; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; + ///State transition - sets the `record_report_count` field to Set + pub struct SetRecordReportCount(PhantomData S>); + impl sealed::Sealed for SetRecordReportCount {} + impl State for SetRecordReportCount { type ReportedRecordCount = S::ReportedRecordCount; - type RecordReportCount = S::RecordReportCount; + type RecordReportCount = Set; + type TakendownRecordCount = S::TakendownRecordCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = S::AccountReportCount; } ///State transition - sets the `takendown_record_count` field to Set pub struct SetTakendownRecordCount(PhantomData S>); impl sealed::Sealed for SetTakendownRecordCount {} impl State for SetTakendownRecordCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; + type ReportedRecordCount = S::ReportedRecordCount; + type RecordReportCount = S::RecordReportCount; type TakendownRecordCount = Set; + type TakendownAccountCount = S::TakendownAccountCount; type ReportedAccountCount = S::ReportedAccountCount; + type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; + type AccountReportCount = S::AccountReportCount; + } + ///State transition - sets the `takendown_account_count` field to Set + pub struct SetTakendownAccountCount(PhantomData S>); + impl sealed::Sealed for SetTakendownAccountCount {} + impl State for SetTakendownAccountCount { type ReportedRecordCount = S::ReportedRecordCount; type RecordReportCount = S::RecordReportCount; - type TakendownAccountCount = S::TakendownAccountCount; + type TakendownRecordCount = S::TakendownRecordCount; + type TakendownAccountCount = Set; + type ReportedAccountCount = S::ReportedAccountCount; type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = S::AccountReportCount; } ///State transition - sets the `reported_account_count` field to Set pub struct SetReportedAccountCount(PhantomData S>); impl sealed::Sealed for SetReportedAccountCount {} impl State for SetReportedAccountCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = Set; type ReportedRecordCount = S::ReportedRecordCount; type RecordReportCount = S::RecordReportCount; - type TakendownAccountCount = S::TakendownAccountCount; - type LabeledRecordCount = S::LabeledRecordCount; - type AccountReportCount = S::AccountReportCount; - } - ///State transition - sets the `reported_record_count` field to Set - pub struct SetReportedRecordCount(PhantomData S>); - impl sealed::Sealed for SetReportedRecordCount {} - impl State for SetReportedRecordCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = Set; - type RecordReportCount = S::RecordReportCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = Set; type LabeledRecordCount = S::LabeledRecordCount; - type AccountReportCount = S::AccountReportCount; - } - ///State transition - sets the `record_report_count` field to Set - pub struct SetRecordReportCount(PhantomData S>); - impl sealed::Sealed for SetRecordReportCount {} - impl State for SetRecordReportCount { - type LabeledAccountCount = S::LabeledAccountCount; type Did = S::Did; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; - type RecordReportCount = Set; - type TakendownAccountCount = S::TakendownAccountCount; - type LabeledRecordCount = S::LabeledRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = S::AccountReportCount; } - ///State transition - sets the `takendown_account_count` field to Set - pub struct SetTakendownAccountCount(PhantomData S>); - impl sealed::Sealed for SetTakendownAccountCount {} - impl State for SetTakendownAccountCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; + ///State transition - sets the `labeled_record_count` field to Set + pub struct SetLabeledRecordCount(PhantomData S>); + impl sealed::Sealed for SetLabeledRecordCount {} + impl State for SetLabeledRecordCount { + type ReportedRecordCount = S::ReportedRecordCount; + type RecordReportCount = S::RecordReportCount; type TakendownRecordCount = S::TakendownRecordCount; + type TakendownAccountCount = S::TakendownAccountCount; type ReportedAccountCount = S::ReportedAccountCount; + type LabeledRecordCount = Set; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; + type AccountReportCount = S::AccountReportCount; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { type ReportedRecordCount = S::ReportedRecordCount; type RecordReportCount = S::RecordReportCount; - type TakendownAccountCount = Set; + type TakendownRecordCount = S::TakendownRecordCount; + type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type LabeledRecordCount = S::LabeledRecordCount; + type Did = Set; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = S::AccountReportCount; } - ///State transition - sets the `labeled_record_count` field to Set - pub struct SetLabeledRecordCount(PhantomData S>); - impl sealed::Sealed for SetLabeledRecordCount {} - impl State for SetLabeledRecordCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; + ///State transition - sets the `labeled_account_count` field to Set + pub struct SetLabeledAccountCount(PhantomData S>); + impl sealed::Sealed for SetLabeledAccountCount {} + impl State for SetLabeledAccountCount { type ReportedRecordCount = S::ReportedRecordCount; type RecordReportCount = S::RecordReportCount; + type TakendownRecordCount = S::TakendownRecordCount; type TakendownAccountCount = S::TakendownAccountCount; - type LabeledRecordCount = Set; + type ReportedAccountCount = S::ReportedAccountCount; + type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = Set; type AccountReportCount = S::AccountReportCount; } ///State transition - sets the `account_report_count` field to Set pub struct SetAccountReportCount(PhantomData S>); impl sealed::Sealed for SetAccountReportCount {} impl State for SetAccountReportCount { - type LabeledAccountCount = S::LabeledAccountCount; - type Did = S::Did; - type TakendownRecordCount = S::TakendownRecordCount; - type ReportedAccountCount = S::ReportedAccountCount; type ReportedRecordCount = S::ReportedRecordCount; type RecordReportCount = S::RecordReportCount; + type TakendownRecordCount = S::TakendownRecordCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type LabeledRecordCount = S::LabeledRecordCount; + type Did = S::Did; + type LabeledAccountCount = S::LabeledAccountCount; type AccountReportCount = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `labeled_account_count` field - pub struct labeled_account_count(()); - ///Marker type for the `did` field - pub struct did(()); - ///Marker type for the `takendown_record_count` field - pub struct takendown_record_count(()); - ///Marker type for the `reported_account_count` field - pub struct reported_account_count(()); ///Marker type for the `reported_record_count` field pub struct reported_record_count(()); ///Marker type for the `record_report_count` field pub struct record_report_count(()); + ///Marker type for the `takendown_record_count` field + pub struct takendown_record_count(()); ///Marker type for the `takendown_account_count` field pub struct takendown_account_count(()); + ///Marker type for the `reported_account_count` field + pub struct reported_account_count(()); ///Marker type for the `labeled_record_count` field pub struct labeled_record_count(()); + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `labeled_account_count` field + pub struct labeled_account_count(()); ///Marker type for the `account_report_count` field pub struct account_report_count(()); } @@ -11601,14 +12190,14 @@ where impl<'a, S> ReporterStatsBuilder<'a, S> where S: reporter_stats_state::State, - S::LabeledAccountCount: reporter_stats_state::IsSet, - S::Did: reporter_stats_state::IsSet, - S::TakendownRecordCount: reporter_stats_state::IsSet, - S::ReportedAccountCount: reporter_stats_state::IsSet, S::ReportedRecordCount: reporter_stats_state::IsSet, S::RecordReportCount: reporter_stats_state::IsSet, + S::TakendownRecordCount: reporter_stats_state::IsSet, S::TakendownAccountCount: reporter_stats_state::IsSet, + S::ReportedAccountCount: reporter_stats_state::IsSet, S::LabeledRecordCount: reporter_stats_state::IsSet, + S::Did: reporter_stats_state::IsSet, + S::LabeledAccountCount: reporter_stats_state::IsSet, S::AccountReportCount: reporter_stats_state::IsSet, { /// Build the final struct @@ -11661,7 +12250,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReporterStats<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -11770,7 +12359,7 @@ for RevokeAccountCredentialsEvent<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -11812,7 +12401,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduleTakedownEvent<'a> } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -11832,7 +12421,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduleTakedownEvent<'a> pub struct ScheduledActionView<'a> { /// Type of action to be executed #[serde(borrow)] - pub action: jacquard_common::CowStr<'a>, + pub action: ScheduledActionViewAction<'a>, /// When the scheduled action was created pub created_at: jacquard_common::types::string::Datetime, /// DID of the user who created this scheduled action @@ -11871,7 +12460,7 @@ pub struct ScheduledActionView<'a> { pub randomize_execution: std::option::Option, /// Current status of the scheduled action #[serde(borrow)] - pub status: jacquard_common::CowStr<'a>, + pub status: ScheduledActionViewStatus<'a>, /// When the scheduled action was last updated #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, @@ -11887,103 +12476,103 @@ pub mod scheduled_action_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Id; type CreatedAt; - type Did; type Status; - type Id; type Action; + type Did; type CreatedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Id = Unset; type CreatedAt = Unset; - type Did = Unset; type Status = Unset; - type Id = Unset; type Action = Unset; + type Did = Unset; type CreatedBy = Unset; } + ///State transition - sets the `id` field to Set + pub struct SetId(PhantomData S>); + impl sealed::Sealed for SetId {} + impl State for SetId { + type Id = Set; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + type Action = S::Action; + type Did = S::Did; + type CreatedBy = S::CreatedBy; + } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type CreatedAt = Set; - type Did = S::Did; - type Status = S::Status; type Id = S::Id; - type Action = S::Action; - type CreatedBy = S::CreatedBy; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData S>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type CreatedAt = S::CreatedAt; - type Did = Set; + type CreatedAt = Set; type Status = S::Status; - type Id = S::Id; type Action = S::Action; + type Did = S::Did; type CreatedBy = S::CreatedBy; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { + type Id = S::Id; type CreatedAt = S::CreatedAt; - type Did = S::Did; type Status = Set; - type Id = S::Id; type Action = S::Action; - type CreatedBy = S::CreatedBy; - } - ///State transition - sets the `id` field to Set - pub struct SetId(PhantomData S>); - impl sealed::Sealed for SetId {} - impl State for SetId { - type CreatedAt = S::CreatedAt; type Did = S::Did; - type Status = S::Status; - type Id = Set; - type Action = S::Action; type CreatedBy = S::CreatedBy; } ///State transition - sets the `action` field to Set pub struct SetAction(PhantomData S>); impl sealed::Sealed for SetAction {} impl State for SetAction { + type Id = S::Id; type CreatedAt = S::CreatedAt; - type Did = S::Did; type Status = S::Status; - type Id = S::Id; type Action = Set; + type Did = S::Did; + type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData S>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Id = S::Id; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + type Action = S::Action; + type Did = Set; type CreatedBy = S::CreatedBy; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { + type Id = S::Id; type CreatedAt = S::CreatedAt; - type Did = S::Did; type Status = S::Status; - type Id = S::Id; type Action = S::Action; + type Did = S::Did; type CreatedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `status` field pub struct status(()); - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `action` field pub struct action(()); + ///Marker type for the `did` field + pub struct did(()); ///Marker type for the `created_by` field pub struct created_by(()); } @@ -11993,7 +12582,7 @@ pub mod scheduled_action_view_state { pub struct ScheduledActionViewBuilder<'a, S: scheduled_action_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, @@ -12006,7 +12595,7 @@ pub struct ScheduledActionViewBuilder<'a, S: scheduled_action_view_state::State> ::core::option::Option, ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -12054,7 +12643,7 @@ where /// Set the `action` field (required) pub fn action( mut self, - value: impl Into>, + value: impl Into>, ) -> ScheduledActionViewBuilder<'a, scheduled_action_view_state::SetAction> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ScheduledActionViewBuilder { @@ -12289,7 +12878,7 @@ where /// Set the `status` field (required) pub fn status( mut self, - value: impl Into>, + value: impl Into>, ) -> ScheduledActionViewBuilder<'a, scheduled_action_view_state::SetStatus> { self.__unsafe_private_named.13 = ::core::option::Option::Some(value.into()); ScheduledActionViewBuilder { @@ -12322,11 +12911,11 @@ impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, S impl<'a, S> ScheduledActionViewBuilder<'a, S> where S: scheduled_action_view_state::State, + S::Id: scheduled_action_view_state::IsSet, S::CreatedAt: scheduled_action_view_state::IsSet, - S::Did: scheduled_action_view_state::IsSet, S::Status: scheduled_action_view_state::IsSet, - S::Id: scheduled_action_view_state::IsSet, S::Action: scheduled_action_view_state::IsSet, + S::Did: scheduled_action_view_state::IsSet, S::CreatedBy: scheduled_action_view_state::IsSet, { /// Build the final struct @@ -12379,6 +12968,193 @@ where } } +/// Type of action to be executed +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ScheduledActionViewAction<'a> { + Takedown, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ScheduledActionViewAction<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Takedown => "takedown", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ScheduledActionViewAction<'a> { + fn from(s: &'a str) -> Self { + match s { + "takedown" => Self::Takedown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ScheduledActionViewAction<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "takedown" => Self::Takedown, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ScheduledActionViewAction<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ScheduledActionViewAction<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ScheduledActionViewAction<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ScheduledActionViewAction<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ScheduledActionViewAction<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ScheduledActionViewAction<'_> { + type Output = ScheduledActionViewAction<'static>; + fn into_static(self) -> Self::Output { + match self { + ScheduledActionViewAction::Takedown => ScheduledActionViewAction::Takedown, + ScheduledActionViewAction::Other(v) => { + ScheduledActionViewAction::Other(v.into_static()) + } + } + } +} + +/// Current status of the scheduled action +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ScheduledActionViewStatus<'a> { + Pending, + Executed, + Cancelled, + Failed, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ScheduledActionViewStatus<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Pending => "pending", + Self::Executed => "executed", + Self::Cancelled => "cancelled", + Self::Failed => "failed", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ScheduledActionViewStatus<'a> { + fn from(s: &'a str) -> Self { + match s { + "pending" => Self::Pending, + "executed" => Self::Executed, + "cancelled" => Self::Cancelled, + "failed" => Self::Failed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ScheduledActionViewStatus<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "pending" => Self::Pending, + "executed" => Self::Executed, + "cancelled" => Self::Cancelled, + "failed" => Self::Failed, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ScheduledActionViewStatus<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ScheduledActionViewStatus<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ScheduledActionViewStatus<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ScheduledActionViewStatus<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ScheduledActionViewStatus<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ScheduledActionViewStatus<'_> { + type Output = ScheduledActionViewStatus<'static>; + fn into_static(self) -> Self::Output { + match self { + ScheduledActionViewStatus::Pending => ScheduledActionViewStatus::Pending, + ScheduledActionViewStatus::Executed => ScheduledActionViewStatus::Executed, + ScheduledActionViewStatus::Cancelled => ScheduledActionViewStatus::Cancelled, + ScheduledActionViewStatus::Failed => ScheduledActionViewStatus::Failed, + ScheduledActionViewStatus::Other(v) => { + ScheduledActionViewStatus::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduledActionView<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.defs" @@ -12391,7 +13167,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduledActionView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -12471,6 +13247,12 @@ impl<'a> AsRef for SubjectReviewState<'a> { } } +impl<'a> core::fmt::Display for SubjectReviewState<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for SubjectReviewState<'a> { fn serialize(&self, serializer: S) -> Result where @@ -12541,11 +13323,13 @@ pub struct SubjectStatusView<'a> { /// Current age assurance state of the subject. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub age_assurance_state: std::option::Option>, + pub age_assurance_state: std::option::Option>, /// Whether or not the last successful update to age assurance was made by the user or admin. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub age_assurance_updated_by: std::option::Option>, + pub age_assurance_updated_by: std::option::Option< + SubjectStatusViewAgeAssuranceUpdatedBy<'a>, + >, /// True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub appealed: std::option::Option, @@ -12617,85 +13401,85 @@ pub mod subject_status_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UpdatedAt; - type Id; type CreatedAt; + type UpdatedAt; type Subject; type ReviewState; + type Id; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UpdatedAt = Unset; - type Id = Unset; type CreatedAt = Unset; + type UpdatedAt = Unset; type Subject = Unset; type ReviewState = Unset; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt(PhantomData S>); - impl sealed::Sealed for SetUpdatedAt {} - impl State for SetUpdatedAt { - type UpdatedAt = Set; - type Id = S::Id; - type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type ReviewState = S::ReviewState; - } - ///State transition - sets the `id` field to Set - pub struct SetId(PhantomData S>); - impl sealed::Sealed for SetId {} - impl State for SetId { - type UpdatedAt = S::UpdatedAt; - type Id = Set; - type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type ReviewState = S::ReviewState; + type Id = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { + type CreatedAt = Set; type UpdatedAt = S::UpdatedAt; + type Subject = S::Subject; + type ReviewState = S::ReviewState; type Id = S::Id; - type CreatedAt = Set; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt(PhantomData S>); + impl sealed::Sealed for SetUpdatedAt {} + impl State for SetUpdatedAt { + type CreatedAt = S::CreatedAt; + type UpdatedAt = Set; type Subject = S::Subject; type ReviewState = S::ReviewState; + type Id = S::Id; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type UpdatedAt = S::UpdatedAt; - type Id = S::Id; type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; type Subject = Set; type ReviewState = S::ReviewState; + type Id = S::Id; } ///State transition - sets the `review_state` field to Set pub struct SetReviewState(PhantomData S>); impl sealed::Sealed for SetReviewState {} impl State for SetReviewState { + type CreatedAt = S::CreatedAt; type UpdatedAt = S::UpdatedAt; + type Subject = S::Subject; + type ReviewState = Set; type Id = S::Id; + } + ///State transition - sets the `id` field to Set + pub struct SetId(PhantomData S>); + impl sealed::Sealed for SetId {} + impl State for SetId { type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; type Subject = S::Subject; - type ReviewState = Set; + type ReviewState = S::ReviewState; + type Id = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `updated_at` field - pub struct updated_at(()); - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `review_state` field pub struct review_state(()); + ///Marker type for the `id` field + pub struct id(()); } } @@ -12705,8 +13489,8 @@ pub struct SubjectStatusViewBuilder<'a, S: subject_status_view_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, @@ -12818,7 +13602,7 @@ impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> { /// Set the `ageAssuranceState` field (optional) pub fn age_assurance_state( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -12826,7 +13610,7 @@ impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> { /// Set the `ageAssuranceState` field to an Option value (optional) pub fn maybe_age_assurance_state( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -12837,7 +13621,7 @@ impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> { /// Set the `ageAssuranceUpdatedBy` field (optional) pub fn age_assurance_updated_by( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self @@ -12845,7 +13629,7 @@ impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> { /// Set the `ageAssuranceUpdatedBy` field to an Option value (optional) pub fn maybe_age_assurance_updated_by( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self @@ -13230,11 +14014,11 @@ where impl<'a, S> SubjectStatusViewBuilder<'a, S> where S: subject_status_view_state::State, - S::UpdatedAt: subject_status_view_state::IsSet, - S::Id: subject_status_view_state::IsSet, S::CreatedAt: subject_status_view_state::IsSet, + S::UpdatedAt: subject_status_view_state::IsSet, S::Subject: subject_status_view_state::IsSet, S::ReviewState: subject_status_view_state::IsSet, + S::Id: subject_status_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SubjectStatusView<'a> { @@ -13306,6 +14090,217 @@ where } } +/// Current age assurance state of the subject. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SubjectStatusViewAgeAssuranceState<'a> { + Pending, + Assured, + Unknown, + Reset, + Blocked, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SubjectStatusViewAgeAssuranceState<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Pending => "pending", + Self::Assured => "assured", + Self::Unknown => "unknown", + Self::Reset => "reset", + Self::Blocked => "blocked", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SubjectStatusViewAgeAssuranceState<'a> { + fn from(s: &'a str) -> Self { + match s { + "pending" => Self::Pending, + "assured" => Self::Assured, + "unknown" => Self::Unknown, + "reset" => Self::Reset, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SubjectStatusViewAgeAssuranceState<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "pending" => Self::Pending, + "assured" => Self::Assured, + "unknown" => Self::Unknown, + "reset" => Self::Reset, + "blocked" => Self::Blocked, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SubjectStatusViewAgeAssuranceState<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SubjectStatusViewAgeAssuranceState<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SubjectStatusViewAgeAssuranceState<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SubjectStatusViewAgeAssuranceState<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SubjectStatusViewAgeAssuranceState<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SubjectStatusViewAgeAssuranceState<'_> { + type Output = SubjectStatusViewAgeAssuranceState<'static>; + fn into_static(self) -> Self::Output { + match self { + SubjectStatusViewAgeAssuranceState::Pending => { + SubjectStatusViewAgeAssuranceState::Pending + } + SubjectStatusViewAgeAssuranceState::Assured => { + SubjectStatusViewAgeAssuranceState::Assured + } + SubjectStatusViewAgeAssuranceState::Unknown => { + SubjectStatusViewAgeAssuranceState::Unknown + } + SubjectStatusViewAgeAssuranceState::Reset => { + SubjectStatusViewAgeAssuranceState::Reset + } + SubjectStatusViewAgeAssuranceState::Blocked => { + SubjectStatusViewAgeAssuranceState::Blocked + } + SubjectStatusViewAgeAssuranceState::Other(v) => { + SubjectStatusViewAgeAssuranceState::Other(v.into_static()) + } + } + } +} + +/// Whether or not the last successful update to age assurance was made by the user or admin. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + Admin, + User, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Admin => "admin", + Self::User => "user", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn from(s: &'a str) -> Self { + match s { + "admin" => Self::Admin, + "user" => Self::User, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "admin" => Self::Admin, + "user" => Self::User, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for SubjectStatusViewAgeAssuranceUpdatedBy<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for SubjectStatusViewAgeAssuranceUpdatedBy<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for SubjectStatusViewAgeAssuranceUpdatedBy<'_> { + type Output = SubjectStatusViewAgeAssuranceUpdatedBy<'static>; + fn into_static(self) -> Self::Output { + match self { + SubjectStatusViewAgeAssuranceUpdatedBy::Admin => { + SubjectStatusViewAgeAssuranceUpdatedBy::Admin + } + SubjectStatusViewAgeAssuranceUpdatedBy::User => { + SubjectStatusViewAgeAssuranceUpdatedBy::User + } + SubjectStatusViewAgeAssuranceUpdatedBy::Other(v) => { + SubjectStatusViewAgeAssuranceUpdatedBy::Other(v.into_static()) + } + } + } +} + #[jacquard_derive::open_union] #[derive( serde::Serialize, @@ -13358,7 +14353,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubjectStatusView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.priority_score { if *value > 100i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { @@ -13660,7 +14655,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubjectView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -13746,51 +14741,51 @@ pub mod video_details_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Width; type Length; type Height; - type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Width = Unset; type Length = Unset; type Height = Unset; - type Width = Unset; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth(PhantomData S>); + impl sealed::Sealed for SetWidth {} + impl State for SetWidth { + type Width = Set; + type Length = S::Length; + type Height = S::Height; } ///State transition - sets the `length` field to Set pub struct SetLength(PhantomData S>); impl sealed::Sealed for SetLength {} impl State for SetLength { + type Width = S::Width; type Length = Set; type Height = S::Height; - type Width = S::Width; } ///State transition - sets the `height` field to Set pub struct SetHeight(PhantomData S>); impl sealed::Sealed for SetHeight {} impl State for SetHeight { - type Length = S::Length; - type Height = Set; type Width = S::Width; - } - ///State transition - sets the `width` field to Set - pub struct SetWidth(PhantomData S>); - impl sealed::Sealed for SetWidth {} - impl State for SetWidth { type Length = S::Length; - type Height = S::Height; - type Width = Set; + type Height = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `width` field + pub struct width(()); ///Marker type for the `length` field pub struct length(()); ///Marker type for the `height` field pub struct height(()); - ///Marker type for the `width` field - pub struct width(()); } } @@ -13883,9 +14878,9 @@ where impl<'a, S> VideoDetailsBuilder<'a, S> where S: video_details_state::State, + S::Width: video_details_state::IsSet, S::Length: video_details_state::IsSet, S::Height: video_details_state::IsSet, - S::Width: video_details_state::IsSet, { /// Build the final struct pub fn build(self) -> VideoDetails<'a> { @@ -13925,7 +14920,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VideoDetails<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/moderation/cancel_scheduled_actions.rs b/crates/weaver-api/src/tools_ozone/moderation/cancel_scheduled_actions.rs index 2645ecb..fc589c0 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/cancel_scheduled_actions.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/cancel_scheduled_actions.rs @@ -37,37 +37,37 @@ pub mod cancellation_results_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Failed; type Succeeded; + type Failed; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Failed = Unset; type Succeeded = Unset; - } - ///State transition - sets the `failed` field to Set - pub struct SetFailed(PhantomData S>); - impl sealed::Sealed for SetFailed {} - impl State for SetFailed { - type Failed = Set; - type Succeeded = S::Succeeded; + type Failed = Unset; } ///State transition - sets the `succeeded` field to Set pub struct SetSucceeded(PhantomData S>); impl sealed::Sealed for SetSucceeded {} impl State for SetSucceeded { - type Failed = S::Failed; type Succeeded = Set; + type Failed = S::Failed; + } + ///State transition - sets the `failed` field to Set + pub struct SetFailed(PhantomData S>); + impl sealed::Sealed for SetFailed {} + impl State for SetFailed { + type Succeeded = S::Succeeded; + type Failed = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `failed` field - pub struct failed(()); ///Marker type for the `succeeded` field pub struct succeeded(()); + ///Marker type for the `failed` field + pub struct failed(()); } } @@ -152,8 +152,8 @@ where impl<'a, S> CancellationResultsBuilder<'a, S> where S: cancellation_results_state::State, - S::Failed: cancellation_results_state::IsSet, S::Succeeded: cancellation_results_state::IsSet, + S::Failed: cancellation_results_state::IsSet, { /// Build the final struct pub fn build(self) -> CancellationResults<'a> { @@ -190,7 +190,7 @@ fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> ::jacquard_lex revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cancellationResults"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -204,7 +204,7 @@ fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> ::jacquard_lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("failed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -268,7 +268,7 @@ fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> ::jacquard_lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -343,7 +343,7 @@ fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> ::jacquard_lex nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -417,7 +417,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CancellationResults<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -453,37 +453,37 @@ pub mod failed_cancellation_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Error; type Did; + type Error; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Error = Unset; type Did = Unset; - } - ///State transition - sets the `error` field to Set - pub struct SetError(PhantomData S>); - impl sealed::Sealed for SetError {} - impl State for SetError { - type Error = Set; - type Did = S::Did; + type Error = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { - type Error = S::Error; type Did = Set; + type Error = S::Error; + } + ///State transition - sets the `error` field to Set + pub struct SetError(PhantomData S>); + impl sealed::Sealed for SetError {} + impl State for SetError { + type Did = S::Did; + type Error = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `error` field - pub struct error(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `error` field + pub struct error(()); } } @@ -576,8 +576,8 @@ impl<'a, S: failed_cancellation_state::State> FailedCancellationBuilder<'a, S> { impl<'a, S> FailedCancellationBuilder<'a, S> where S: failed_cancellation_state::State, - S::Error: failed_cancellation_state::IsSet, S::Did: failed_cancellation_state::IsSet, + S::Error: failed_cancellation_state::IsSet, { /// Build the final struct pub fn build(self) -> FailedCancellation<'a> { @@ -617,7 +617,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FailedCancellation<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/tools_ozone/moderation/emit_event.rs b/crates/weaver-api/src/tools_ozone/moderation/emit_event.rs index d9c1a59..4c81045 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/emit_event.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/emit_event.rs @@ -47,51 +47,51 @@ pub mod emit_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Event; type Subject; type CreatedBy; + type Event; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Event = Unset; type Subject = Unset; type CreatedBy = Unset; - } - ///State transition - sets the `event` field to Set - pub struct SetEvent(PhantomData S>); - impl sealed::Sealed for SetEvent {} - impl State for SetEvent { - type Event = Set; - type Subject = S::Subject; - type CreatedBy = S::CreatedBy; + type Event = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type Event = S::Event; type Subject = Set; type CreatedBy = S::CreatedBy; + type Event = S::Event; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { - type Event = S::Event; type Subject = S::Subject; type CreatedBy = Set; + type Event = S::Event; + } + ///State transition - sets the `event` field to Set + pub struct SetEvent(PhantomData S>); + impl sealed::Sealed for SetEvent {} + impl State for SetEvent { + type Subject = S::Subject; + type CreatedBy = S::CreatedBy; + type Event = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `event` field - pub struct event(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `created_by` field pub struct created_by(()); + ///Marker type for the `event` field + pub struct event(()); } } @@ -244,9 +244,9 @@ impl<'a, S: emit_event_state::State> EmitEventBuilder<'a, S> { impl<'a, S> EmitEventBuilder<'a, S> where S: emit_event_state::State, - S::Event: emit_event_state::IsSet, S::Subject: emit_event_state::IsSet, S::CreatedBy: emit_event_state::IsSet, + S::Event: emit_event_state::IsSet, { /// Build the final struct pub fn build(self) -> EmitEvent<'a> { @@ -417,8 +417,8 @@ pub enum EmitEventError<'a> { DuplicateExternalId(std::option::Option>), } -impl std::fmt::Display for EmitEventError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for EmitEventError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::SubjectHasAction(msg) => { write!(f, "SubjectHasAction")?; diff --git a/crates/weaver-api/src/tools_ozone/moderation/get_account_timeline.rs b/crates/weaver-api/src/tools_ozone/moderation/get_account_timeline.rs index 9ca555e..0079811 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/get_account_timeline.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/get_account_timeline.rs @@ -148,8 +148,8 @@ pub enum GetAccountTimelineError<'a> { RepoNotFound(std::option::Option>), } -impl std::fmt::Display for GetAccountTimelineError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetAccountTimelineError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; @@ -372,7 +372,7 @@ fn lexicon_doc_tools_ozone_moderation_getAccountTimeline() -> ::jacquard_lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -387,7 +387,7 @@ fn lexicon_doc_tools_ozone_moderation_getAccountTimeline() -> ::jacquard_lexicon ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -426,7 +426,7 @@ fn lexicon_doc_tools_ozone_moderation_getAccountTimeline() -> ::jacquard_lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("day"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -474,7 +474,7 @@ fn lexicon_doc_tools_ozone_moderation_getAccountTimeline() -> ::jacquard_lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("count"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { @@ -541,7 +541,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TimelineItem<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -560,9 +560,9 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TimelineItem<'a> { pub struct TimelineItemSummary<'a> { pub count: i64, #[serde(borrow)] - pub event_subject_type: jacquard_common::CowStr<'a>, + pub event_subject_type: TimelineItemSummaryEventSubjectType<'a>, #[serde(borrow)] - pub event_type: jacquard_common::CowStr<'a>, + pub event_type: TimelineItemSummaryEventType<'a>, } pub mod timeline_item_summary_state { @@ -575,51 +575,51 @@ pub mod timeline_item_summary_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EventType; - type EventSubjectType; type Count; + type EventSubjectType; + type EventType; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EventType = Unset; - type EventSubjectType = Unset; type Count = Unset; + type EventSubjectType = Unset; + type EventType = Unset; } - ///State transition - sets the `event_type` field to Set - pub struct SetEventType(PhantomData S>); - impl sealed::Sealed for SetEventType {} - impl State for SetEventType { - type EventType = Set; + ///State transition - sets the `count` field to Set + pub struct SetCount(PhantomData S>); + impl sealed::Sealed for SetCount {} + impl State for SetCount { + type Count = Set; type EventSubjectType = S::EventSubjectType; - type Count = S::Count; + type EventType = S::EventType; } ///State transition - sets the `event_subject_type` field to Set pub struct SetEventSubjectType(PhantomData S>); impl sealed::Sealed for SetEventSubjectType {} impl State for SetEventSubjectType { - type EventType = S::EventType; - type EventSubjectType = Set; type Count = S::Count; - } - ///State transition - sets the `count` field to Set - pub struct SetCount(PhantomData S>); - impl sealed::Sealed for SetCount {} - impl State for SetCount { + type EventSubjectType = Set; type EventType = S::EventType; + } + ///State transition - sets the `event_type` field to Set + pub struct SetEventType(PhantomData S>); + impl sealed::Sealed for SetEventType {} + impl State for SetEventType { + type Count = S::Count; type EventSubjectType = S::EventSubjectType; - type Count = Set; + type EventType = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `event_type` field - pub struct event_type(()); - ///Marker type for the `event_subject_type` field - pub struct event_subject_type(()); ///Marker type for the `count` field pub struct count(()); + ///Marker type for the `event_subject_type` field + pub struct event_subject_type(()); + ///Marker type for the `event_type` field + pub struct event_type(()); } } @@ -628,8 +628,8 @@ pub struct TimelineItemSummaryBuilder<'a, S: timeline_item_summary_state::State> _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -679,7 +679,7 @@ where /// Set the `eventSubjectType` field (required) pub fn event_subject_type( mut self, - value: impl Into>, + value: impl Into>, ) -> TimelineItemSummaryBuilder< 'a, timeline_item_summary_state::SetEventSubjectType, @@ -701,7 +701,7 @@ where /// Set the `eventType` field (required) pub fn event_type( mut self, - value: impl Into>, + value: impl Into>, ) -> TimelineItemSummaryBuilder<'a, timeline_item_summary_state::SetEventType> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); TimelineItemSummaryBuilder { @@ -715,9 +715,9 @@ where impl<'a, S> TimelineItemSummaryBuilder<'a, S> where S: timeline_item_summary_state::State, - S::EventType: timeline_item_summary_state::IsSet, - S::EventSubjectType: timeline_item_summary_state::IsSet, S::Count: timeline_item_summary_state::IsSet, + S::EventSubjectType: timeline_item_summary_state::IsSet, + S::EventType: timeline_item_summary_state::IsSet, { /// Build the final struct pub fn build(self) -> TimelineItemSummary<'a> { @@ -745,6 +745,500 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum TimelineItemSummaryEventSubjectType<'a> { + Account, + Record, + Chat, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> TimelineItemSummaryEventSubjectType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Account => "account", + Self::Record => "record", + Self::Chat => "chat", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for TimelineItemSummaryEventSubjectType<'a> { + fn from(s: &'a str) -> Self { + match s { + "account" => Self::Account, + "record" => Self::Record, + "chat" => Self::Chat, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for TimelineItemSummaryEventSubjectType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "account" => Self::Account, + "record" => Self::Record, + "chat" => Self::Chat, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for TimelineItemSummaryEventSubjectType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for TimelineItemSummaryEventSubjectType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for TimelineItemSummaryEventSubjectType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for TimelineItemSummaryEventSubjectType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for TimelineItemSummaryEventSubjectType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for TimelineItemSummaryEventSubjectType<'_> { + type Output = TimelineItemSummaryEventSubjectType<'static>; + fn into_static(self) -> Self::Output { + match self { + TimelineItemSummaryEventSubjectType::Account => { + TimelineItemSummaryEventSubjectType::Account + } + TimelineItemSummaryEventSubjectType::Record => { + TimelineItemSummaryEventSubjectType::Record + } + TimelineItemSummaryEventSubjectType::Chat => { + TimelineItemSummaryEventSubjectType::Chat + } + TimelineItemSummaryEventSubjectType::Other(v) => { + TimelineItemSummaryEventSubjectType::Other(v.into_static()) + } + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum TimelineItemSummaryEventType<'a> { + ModEventTakedown, + ModEventReverseTakedown, + ModEventComment, + ModEventReport, + ModEventLabel, + ModEventAcknowledge, + ModEventEscalate, + ModEventMute, + ModEventUnmute, + ModEventMuteReporter, + ModEventUnmuteReporter, + ModEventEmail, + ModEventResolveAppeal, + ModEventDivert, + ModEventTag, + AccountEvent, + IdentityEvent, + RecordEvent, + ModEventPriorityScore, + RevokeAccountCredentialsEvent, + AgeAssuranceEvent, + AgeAssuranceOverrideEvent, + TimelineEventPlcCreate, + TimelineEventPlcOperation, + TimelineEventPlcTombstone, + AccountCreated, + EmailConfirmed, + PasswordUpdated, + HandleUpdated, + ScheduleTakedownEvent, + CancelScheduledTakedownEvent, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> TimelineItemSummaryEventType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::ModEventTakedown => "tools.ozone.moderation.defs#modEventTakedown", + Self::ModEventReverseTakedown => { + "tools.ozone.moderation.defs#modEventReverseTakedown" + } + Self::ModEventComment => "tools.ozone.moderation.defs#modEventComment", + Self::ModEventReport => "tools.ozone.moderation.defs#modEventReport", + Self::ModEventLabel => "tools.ozone.moderation.defs#modEventLabel", + Self::ModEventAcknowledge => { + "tools.ozone.moderation.defs#modEventAcknowledge" + } + Self::ModEventEscalate => "tools.ozone.moderation.defs#modEventEscalate", + Self::ModEventMute => "tools.ozone.moderation.defs#modEventMute", + Self::ModEventUnmute => "tools.ozone.moderation.defs#modEventUnmute", + Self::ModEventMuteReporter => { + "tools.ozone.moderation.defs#modEventMuteReporter" + } + Self::ModEventUnmuteReporter => { + "tools.ozone.moderation.defs#modEventUnmuteReporter" + } + Self::ModEventEmail => "tools.ozone.moderation.defs#modEventEmail", + Self::ModEventResolveAppeal => { + "tools.ozone.moderation.defs#modEventResolveAppeal" + } + Self::ModEventDivert => "tools.ozone.moderation.defs#modEventDivert", + Self::ModEventTag => "tools.ozone.moderation.defs#modEventTag", + Self::AccountEvent => "tools.ozone.moderation.defs#accountEvent", + Self::IdentityEvent => "tools.ozone.moderation.defs#identityEvent", + Self::RecordEvent => "tools.ozone.moderation.defs#recordEvent", + Self::ModEventPriorityScore => { + "tools.ozone.moderation.defs#modEventPriorityScore" + } + Self::RevokeAccountCredentialsEvent => { + "tools.ozone.moderation.defs#revokeAccountCredentialsEvent" + } + Self::AgeAssuranceEvent => "tools.ozone.moderation.defs#ageAssuranceEvent", + Self::AgeAssuranceOverrideEvent => { + "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" + } + Self::TimelineEventPlcCreate => { + "tools.ozone.moderation.defs#timelineEventPlcCreate" + } + Self::TimelineEventPlcOperation => { + "tools.ozone.moderation.defs#timelineEventPlcOperation" + } + Self::TimelineEventPlcTombstone => { + "tools.ozone.moderation.defs#timelineEventPlcTombstone" + } + Self::AccountCreated => { + "tools.ozone.hosting.getAccountHistory#accountCreated" + } + Self::EmailConfirmed => { + "tools.ozone.hosting.getAccountHistory#emailConfirmed" + } + Self::PasswordUpdated => { + "tools.ozone.hosting.getAccountHistory#passwordUpdated" + } + Self::HandleUpdated => "tools.ozone.hosting.getAccountHistory#handleUpdated", + Self::ScheduleTakedownEvent => { + "tools.ozone.moderation.defs#scheduleTakedownEvent" + } + Self::CancelScheduledTakedownEvent => { + "tools.ozone.moderation.defs#cancelScheduledTakedownEvent" + } + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for TimelineItemSummaryEventType<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.moderation.defs#modEventTakedown" => Self::ModEventTakedown, + "tools.ozone.moderation.defs#modEventReverseTakedown" => { + Self::ModEventReverseTakedown + } + "tools.ozone.moderation.defs#modEventComment" => Self::ModEventComment, + "tools.ozone.moderation.defs#modEventReport" => Self::ModEventReport, + "tools.ozone.moderation.defs#modEventLabel" => Self::ModEventLabel, + "tools.ozone.moderation.defs#modEventAcknowledge" => { + Self::ModEventAcknowledge + } + "tools.ozone.moderation.defs#modEventEscalate" => Self::ModEventEscalate, + "tools.ozone.moderation.defs#modEventMute" => Self::ModEventMute, + "tools.ozone.moderation.defs#modEventUnmute" => Self::ModEventUnmute, + "tools.ozone.moderation.defs#modEventMuteReporter" => { + Self::ModEventMuteReporter + } + "tools.ozone.moderation.defs#modEventUnmuteReporter" => { + Self::ModEventUnmuteReporter + } + "tools.ozone.moderation.defs#modEventEmail" => Self::ModEventEmail, + "tools.ozone.moderation.defs#modEventResolveAppeal" => { + Self::ModEventResolveAppeal + } + "tools.ozone.moderation.defs#modEventDivert" => Self::ModEventDivert, + "tools.ozone.moderation.defs#modEventTag" => Self::ModEventTag, + "tools.ozone.moderation.defs#accountEvent" => Self::AccountEvent, + "tools.ozone.moderation.defs#identityEvent" => Self::IdentityEvent, + "tools.ozone.moderation.defs#recordEvent" => Self::RecordEvent, + "tools.ozone.moderation.defs#modEventPriorityScore" => { + Self::ModEventPriorityScore + } + "tools.ozone.moderation.defs#revokeAccountCredentialsEvent" => { + Self::RevokeAccountCredentialsEvent + } + "tools.ozone.moderation.defs#ageAssuranceEvent" => Self::AgeAssuranceEvent, + "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" => { + Self::AgeAssuranceOverrideEvent + } + "tools.ozone.moderation.defs#timelineEventPlcCreate" => { + Self::TimelineEventPlcCreate + } + "tools.ozone.moderation.defs#timelineEventPlcOperation" => { + Self::TimelineEventPlcOperation + } + "tools.ozone.moderation.defs#timelineEventPlcTombstone" => { + Self::TimelineEventPlcTombstone + } + "tools.ozone.hosting.getAccountHistory#accountCreated" => { + Self::AccountCreated + } + "tools.ozone.hosting.getAccountHistory#emailConfirmed" => { + Self::EmailConfirmed + } + "tools.ozone.hosting.getAccountHistory#passwordUpdated" => { + Self::PasswordUpdated + } + "tools.ozone.hosting.getAccountHistory#handleUpdated" => Self::HandleUpdated, + "tools.ozone.moderation.defs#scheduleTakedownEvent" => { + Self::ScheduleTakedownEvent + } + "tools.ozone.moderation.defs#cancelScheduledTakedownEvent" => { + Self::CancelScheduledTakedownEvent + } + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for TimelineItemSummaryEventType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.moderation.defs#modEventTakedown" => Self::ModEventTakedown, + "tools.ozone.moderation.defs#modEventReverseTakedown" => { + Self::ModEventReverseTakedown + } + "tools.ozone.moderation.defs#modEventComment" => Self::ModEventComment, + "tools.ozone.moderation.defs#modEventReport" => Self::ModEventReport, + "tools.ozone.moderation.defs#modEventLabel" => Self::ModEventLabel, + "tools.ozone.moderation.defs#modEventAcknowledge" => { + Self::ModEventAcknowledge + } + "tools.ozone.moderation.defs#modEventEscalate" => Self::ModEventEscalate, + "tools.ozone.moderation.defs#modEventMute" => Self::ModEventMute, + "tools.ozone.moderation.defs#modEventUnmute" => Self::ModEventUnmute, + "tools.ozone.moderation.defs#modEventMuteReporter" => { + Self::ModEventMuteReporter + } + "tools.ozone.moderation.defs#modEventUnmuteReporter" => { + Self::ModEventUnmuteReporter + } + "tools.ozone.moderation.defs#modEventEmail" => Self::ModEventEmail, + "tools.ozone.moderation.defs#modEventResolveAppeal" => { + Self::ModEventResolveAppeal + } + "tools.ozone.moderation.defs#modEventDivert" => Self::ModEventDivert, + "tools.ozone.moderation.defs#modEventTag" => Self::ModEventTag, + "tools.ozone.moderation.defs#accountEvent" => Self::AccountEvent, + "tools.ozone.moderation.defs#identityEvent" => Self::IdentityEvent, + "tools.ozone.moderation.defs#recordEvent" => Self::RecordEvent, + "tools.ozone.moderation.defs#modEventPriorityScore" => { + Self::ModEventPriorityScore + } + "tools.ozone.moderation.defs#revokeAccountCredentialsEvent" => { + Self::RevokeAccountCredentialsEvent + } + "tools.ozone.moderation.defs#ageAssuranceEvent" => Self::AgeAssuranceEvent, + "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" => { + Self::AgeAssuranceOverrideEvent + } + "tools.ozone.moderation.defs#timelineEventPlcCreate" => { + Self::TimelineEventPlcCreate + } + "tools.ozone.moderation.defs#timelineEventPlcOperation" => { + Self::TimelineEventPlcOperation + } + "tools.ozone.moderation.defs#timelineEventPlcTombstone" => { + Self::TimelineEventPlcTombstone + } + "tools.ozone.hosting.getAccountHistory#accountCreated" => { + Self::AccountCreated + } + "tools.ozone.hosting.getAccountHistory#emailConfirmed" => { + Self::EmailConfirmed + } + "tools.ozone.hosting.getAccountHistory#passwordUpdated" => { + Self::PasswordUpdated + } + "tools.ozone.hosting.getAccountHistory#handleUpdated" => Self::HandleUpdated, + "tools.ozone.moderation.defs#scheduleTakedownEvent" => { + Self::ScheduleTakedownEvent + } + "tools.ozone.moderation.defs#cancelScheduledTakedownEvent" => { + Self::CancelScheduledTakedownEvent + } + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for TimelineItemSummaryEventType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for TimelineItemSummaryEventType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for TimelineItemSummaryEventType<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for TimelineItemSummaryEventType<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for TimelineItemSummaryEventType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for TimelineItemSummaryEventType<'_> { + type Output = TimelineItemSummaryEventType<'static>; + fn into_static(self) -> Self::Output { + match self { + TimelineItemSummaryEventType::ModEventTakedown => { + TimelineItemSummaryEventType::ModEventTakedown + } + TimelineItemSummaryEventType::ModEventReverseTakedown => { + TimelineItemSummaryEventType::ModEventReverseTakedown + } + TimelineItemSummaryEventType::ModEventComment => { + TimelineItemSummaryEventType::ModEventComment + } + TimelineItemSummaryEventType::ModEventReport => { + TimelineItemSummaryEventType::ModEventReport + } + TimelineItemSummaryEventType::ModEventLabel => { + TimelineItemSummaryEventType::ModEventLabel + } + TimelineItemSummaryEventType::ModEventAcknowledge => { + TimelineItemSummaryEventType::ModEventAcknowledge + } + TimelineItemSummaryEventType::ModEventEscalate => { + TimelineItemSummaryEventType::ModEventEscalate + } + TimelineItemSummaryEventType::ModEventMute => { + TimelineItemSummaryEventType::ModEventMute + } + TimelineItemSummaryEventType::ModEventUnmute => { + TimelineItemSummaryEventType::ModEventUnmute + } + TimelineItemSummaryEventType::ModEventMuteReporter => { + TimelineItemSummaryEventType::ModEventMuteReporter + } + TimelineItemSummaryEventType::ModEventUnmuteReporter => { + TimelineItemSummaryEventType::ModEventUnmuteReporter + } + TimelineItemSummaryEventType::ModEventEmail => { + TimelineItemSummaryEventType::ModEventEmail + } + TimelineItemSummaryEventType::ModEventResolveAppeal => { + TimelineItemSummaryEventType::ModEventResolveAppeal + } + TimelineItemSummaryEventType::ModEventDivert => { + TimelineItemSummaryEventType::ModEventDivert + } + TimelineItemSummaryEventType::ModEventTag => { + TimelineItemSummaryEventType::ModEventTag + } + TimelineItemSummaryEventType::AccountEvent => { + TimelineItemSummaryEventType::AccountEvent + } + TimelineItemSummaryEventType::IdentityEvent => { + TimelineItemSummaryEventType::IdentityEvent + } + TimelineItemSummaryEventType::RecordEvent => { + TimelineItemSummaryEventType::RecordEvent + } + TimelineItemSummaryEventType::ModEventPriorityScore => { + TimelineItemSummaryEventType::ModEventPriorityScore + } + TimelineItemSummaryEventType::RevokeAccountCredentialsEvent => { + TimelineItemSummaryEventType::RevokeAccountCredentialsEvent + } + TimelineItemSummaryEventType::AgeAssuranceEvent => { + TimelineItemSummaryEventType::AgeAssuranceEvent + } + TimelineItemSummaryEventType::AgeAssuranceOverrideEvent => { + TimelineItemSummaryEventType::AgeAssuranceOverrideEvent + } + TimelineItemSummaryEventType::TimelineEventPlcCreate => { + TimelineItemSummaryEventType::TimelineEventPlcCreate + } + TimelineItemSummaryEventType::TimelineEventPlcOperation => { + TimelineItemSummaryEventType::TimelineEventPlcOperation + } + TimelineItemSummaryEventType::TimelineEventPlcTombstone => { + TimelineItemSummaryEventType::TimelineEventPlcTombstone + } + TimelineItemSummaryEventType::AccountCreated => { + TimelineItemSummaryEventType::AccountCreated + } + TimelineItemSummaryEventType::EmailConfirmed => { + TimelineItemSummaryEventType::EmailConfirmed + } + TimelineItemSummaryEventType::PasswordUpdated => { + TimelineItemSummaryEventType::PasswordUpdated + } + TimelineItemSummaryEventType::HandleUpdated => { + TimelineItemSummaryEventType::HandleUpdated + } + TimelineItemSummaryEventType::ScheduleTakedownEvent => { + TimelineItemSummaryEventType::ScheduleTakedownEvent + } + TimelineItemSummaryEventType::CancelScheduledTakedownEvent => { + TimelineItemSummaryEventType::CancelScheduledTakedownEvent + } + TimelineItemSummaryEventType::Other(v) => { + TimelineItemSummaryEventType::Other(v.into_static()) + } + } + } +} + impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TimelineItemSummary<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.getAccountTimeline" @@ -757,7 +1251,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TimelineItemSummary<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/moderation/get_record.rs b/crates/weaver-api/src/tools_ozone/moderation/get_record.rs index 9b7376d..d72391b 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/get_record.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/get_record.rs @@ -171,8 +171,8 @@ pub enum GetRecordError<'a> { RecordNotFound(std::option::Option>), } -impl std::fmt::Display for GetRecordError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRecordError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RecordNotFound(msg) => { write!(f, "RecordNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/moderation/get_repo.rs b/crates/weaver-api/src/tools_ozone/moderation/get_repo.rs index 09e3409..f6b0271 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/get_repo.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/get_repo.rs @@ -147,8 +147,8 @@ pub enum GetRepoError<'a> { RepoNotFound(std::option::Option>), } -impl std::fmt::Display for GetRepoError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetRepoError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/moderation/schedule_action.rs b/crates/weaver-api/src/tools_ozone/moderation/schedule_action.rs index 2946ef4..c44d959 100644 --- a/crates/weaver-api/src/tools_ozone/moderation/schedule_action.rs +++ b/crates/weaver-api/src/tools_ozone/moderation/schedule_action.rs @@ -199,7 +199,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("failedScheduling"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -213,7 +213,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("error"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -291,7 +291,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -393,7 +393,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("failed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { @@ -448,7 +448,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "executeAfter", @@ -534,7 +534,7 @@ fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acknowledgeAccountSubjects", @@ -717,7 +717,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FailedScheduling<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -762,66 +762,66 @@ pub mod schedule_action_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Subjects; + type CreatedBy; type Action; type Scheduling; - type CreatedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subjects = Unset; + type CreatedBy = Unset; type Action = Unset; type Scheduling = Unset; - type CreatedBy = Unset; } ///State transition - sets the `subjects` field to Set pub struct SetSubjects(PhantomData S>); impl sealed::Sealed for SetSubjects {} impl State for SetSubjects { type Subjects = Set; + type CreatedBy = S::CreatedBy; + type Action = S::Action; + type Scheduling = S::Scheduling; + } + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy(PhantomData S>); + impl sealed::Sealed for SetCreatedBy {} + impl State for SetCreatedBy { + type Subjects = S::Subjects; + type CreatedBy = Set; type Action = S::Action; type Scheduling = S::Scheduling; - type CreatedBy = S::CreatedBy; } ///State transition - sets the `action` field to Set pub struct SetAction(PhantomData S>); impl sealed::Sealed for SetAction {} impl State for SetAction { type Subjects = S::Subjects; + type CreatedBy = S::CreatedBy; type Action = Set; type Scheduling = S::Scheduling; - type CreatedBy = S::CreatedBy; } ///State transition - sets the `scheduling` field to Set pub struct SetScheduling(PhantomData S>); impl sealed::Sealed for SetScheduling {} impl State for SetScheduling { type Subjects = S::Subjects; - type Action = S::Action; - type Scheduling = Set; type CreatedBy = S::CreatedBy; - } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy(PhantomData S>); - impl sealed::Sealed for SetCreatedBy {} - impl State for SetCreatedBy { - type Subjects = S::Subjects; type Action = S::Action; - type Scheduling = S::Scheduling; - type CreatedBy = Set; + type Scheduling = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subjects` field pub struct subjects(()); + ///Marker type for the `created_by` field + pub struct created_by(()); ///Marker type for the `action` field pub struct action(()); ///Marker type for the `scheduling` field pub struct scheduling(()); - ///Marker type for the `created_by` field - pub struct created_by(()); } } @@ -961,9 +961,9 @@ impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::Subjects: schedule_action_state::IsSet, + S::CreatedBy: schedule_action_state::IsSet, S::Action: schedule_action_state::IsSet, S::Scheduling: schedule_action_state::IsSet, - S::CreatedBy: schedule_action_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduleAction<'a> { @@ -1072,37 +1072,37 @@ pub mod scheduled_action_results_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Failed; type Succeeded; + type Failed; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Failed = Unset; type Succeeded = Unset; - } - ///State transition - sets the `failed` field to Set - pub struct SetFailed(PhantomData S>); - impl sealed::Sealed for SetFailed {} - impl State for SetFailed { - type Failed = Set; - type Succeeded = S::Succeeded; + type Failed = Unset; } ///State transition - sets the `succeeded` field to Set pub struct SetSucceeded(PhantomData S>); impl sealed::Sealed for SetSucceeded {} impl State for SetSucceeded { - type Failed = S::Failed; type Succeeded = Set; + type Failed = S::Failed; + } + ///State transition - sets the `failed` field to Set + pub struct SetFailed(PhantomData S>); + impl sealed::Sealed for SetFailed {} + impl State for SetFailed { + type Succeeded = S::Succeeded; + type Failed = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `failed` field - pub struct failed(()); ///Marker type for the `succeeded` field pub struct succeeded(()); + ///Marker type for the `failed` field + pub struct failed(()); } } @@ -1188,8 +1188,8 @@ where impl<'a, S> ScheduledActionResultsBuilder<'a, S> where S: scheduled_action_results_state::State, - S::Failed: scheduled_action_results_state::IsSet, S::Succeeded: scheduled_action_results_state::IsSet, + S::Failed: scheduled_action_results_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduledActionResults<'a> { @@ -1227,7 +1227,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduledActionResults<'a } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1269,7 +1269,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SchedulingConfig<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -1333,7 +1333,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Takedown<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.policies { #[allow(unused_comparisons)] if value.len() > 5usize { diff --git a/crates/weaver-api/src/tools_ozone/report.rs b/crates/weaver-api/src/tools_ozone/report.rs index 20d899f..1fbbebe 100644 --- a/crates/weaver-api/src/tools_ozone/report.rs +++ b/crates/weaver-api/src/tools_ozone/report.rs @@ -1034,6 +1034,12 @@ impl<'a> AsRef for ReasonType<'a> { } } +impl<'a> core::fmt::Display for ReasonType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ReasonType<'a> { fn serialize(&self, serializer: S) -> Result where diff --git a/crates/weaver-api/src/tools_ozone/safelink.rs b/crates/weaver-api/src/tools_ozone/safelink.rs index 1a589b8..ee28db1 100644 --- a/crates/weaver-api/src/tools_ozone/safelink.rs +++ b/crates/weaver-api/src/tools_ozone/safelink.rs @@ -58,6 +58,12 @@ impl<'a> AsRef for ActionType<'a> { } } +impl<'a> core::fmt::Display for ActionType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ActionType<'a> { fn serialize(&self, serializer: S) -> Result where @@ -138,151 +144,151 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Pattern; + type Url; + type CreatedAt; type Action; - type CreatedBy; + type Id; type EventType; - type CreatedAt; - type Url; - type Pattern; type Reason; - type Id; + type CreatedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Pattern = Unset; + type Url = Unset; + type CreatedAt = Unset; type Action = Unset; - type CreatedBy = Unset; + type Id = Unset; type EventType = Unset; - type CreatedAt = Unset; - type Url = Unset; - type Pattern = Unset; type Reason = Unset; - type Id = Unset; + type CreatedBy = Unset; } - ///State transition - sets the `action` field to Set - pub struct SetAction(PhantomData S>); - impl sealed::Sealed for SetAction {} - impl State for SetAction { - type Action = Set; - type CreatedBy = S::CreatedBy; - type EventType = S::EventType; - type CreatedAt = S::CreatedAt; + ///State transition - sets the `pattern` field to Set + pub struct SetPattern(PhantomData S>); + impl sealed::Sealed for SetPattern {} + impl State for SetPattern { + type Pattern = Set; type Url = S::Url; - type Pattern = S::Pattern; - type Reason = S::Reason; - type Id = S::Id; - } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy(PhantomData S>); - impl sealed::Sealed for SetCreatedBy {} - impl State for SetCreatedBy { + type CreatedAt = S::CreatedAt; type Action = S::Action; - type CreatedBy = Set; + type Id = S::Id; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Url = S::Url; - type Pattern = S::Pattern; type Reason = S::Reason; - type Id = S::Id; - } - ///State transition - sets the `event_type` field to Set - pub struct SetEventType(PhantomData S>); - impl sealed::Sealed for SetEventType {} - impl State for SetEventType { - type Action = S::Action; type CreatedBy = S::CreatedBy; - type EventType = Set; - type CreatedAt = S::CreatedAt; - type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl(PhantomData S>); + impl sealed::Sealed for SetUrl {} + impl State for SetUrl { type Pattern = S::Pattern; - type Reason = S::Reason; + type Url = Set; + type CreatedAt = S::CreatedAt; + type Action = S::Action; type Id = S::Id; + type EventType = S::EventType; + type Reason = S::Reason; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { + type Pattern = S::Pattern; + type Url = S::Url; + type CreatedAt = Set; type Action = S::Action; - type CreatedBy = S::CreatedBy; + type Id = S::Id; type EventType = S::EventType; - type CreatedAt = Set; - type Url = S::Url; - type Pattern = S::Pattern; type Reason = S::Reason; - type Id = S::Id; - } - ///State transition - sets the `url` field to Set - pub struct SetUrl(PhantomData S>); - impl sealed::Sealed for SetUrl {} - impl State for SetUrl { - type Action = S::Action; type CreatedBy = S::CreatedBy; - type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Url = Set; + } + ///State transition - sets the `action` field to Set + pub struct SetAction(PhantomData S>); + impl sealed::Sealed for SetAction {} + impl State for SetAction { type Pattern = S::Pattern; - type Reason = S::Reason; + type Url = S::Url; + type CreatedAt = S::CreatedAt; + type Action = Set; type Id = S::Id; + type EventType = S::EventType; + type Reason = S::Reason; + type CreatedBy = S::CreatedBy; } - ///State transition - sets the `pattern` field to Set - pub struct SetPattern(PhantomData S>); - impl sealed::Sealed for SetPattern {} - impl State for SetPattern { + ///State transition - sets the `id` field to Set + pub struct SetId(PhantomData S>); + impl sealed::Sealed for SetId {} + impl State for SetId { + type Pattern = S::Pattern; + type Url = S::Url; + type CreatedAt = S::CreatedAt; type Action = S::Action; - type CreatedBy = S::CreatedBy; + type Id = Set; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Url = S::Url; - type Pattern = Set; type Reason = S::Reason; + type CreatedBy = S::CreatedBy; + } + ///State transition - sets the `event_type` field to Set + pub struct SetEventType(PhantomData S>); + impl sealed::Sealed for SetEventType {} + impl State for SetEventType { + type Pattern = S::Pattern; + type Url = S::Url; + type CreatedAt = S::CreatedAt; + type Action = S::Action; type Id = S::Id; + type EventType = Set; + type Reason = S::Reason; + type CreatedBy = S::CreatedBy; } ///State transition - sets the `reason` field to Set pub struct SetReason(PhantomData S>); impl sealed::Sealed for SetReason {} impl State for SetReason { + type Pattern = S::Pattern; + type Url = S::Url; + type CreatedAt = S::CreatedAt; type Action = S::Action; - type CreatedBy = S::CreatedBy; + type Id = S::Id; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Url = S::Url; - type Pattern = S::Pattern; type Reason = Set; - type Id = S::Id; + type CreatedBy = S::CreatedBy; } - ///State transition - sets the `id` field to Set - pub struct SetId(PhantomData S>); - impl sealed::Sealed for SetId {} - impl State for SetId { + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy(PhantomData S>); + impl sealed::Sealed for SetCreatedBy {} + impl State for SetCreatedBy { + type Pattern = S::Pattern; + type Url = S::Url; + type CreatedAt = S::CreatedAt; type Action = S::Action; - type CreatedBy = S::CreatedBy; + type Id = S::Id; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Url = S::Url; - type Pattern = S::Pattern; type Reason = S::Reason; - type Id = Set; + type CreatedBy = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `pattern` field + pub struct pattern(()); + ///Marker type for the `url` field + pub struct url(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `action` field pub struct action(()); - ///Marker type for the `created_by` field - pub struct created_by(()); + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `event_type` field pub struct event_type(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `url` field - pub struct url(()); - ///Marker type for the `pattern` field - pub struct pattern(()); ///Marker type for the `reason` field pub struct reason(()); - ///Marker type for the `id` field - pub struct id(()); + ///Marker type for the `created_by` field + pub struct created_by(()); } } @@ -502,14 +508,14 @@ where impl<'a, S> EventBuilder<'a, S> where S: event_state::State, + S::Pattern: event_state::IsSet, + S::Url: event_state::IsSet, + S::CreatedAt: event_state::IsSet, S::Action: event_state::IsSet, - S::CreatedBy: event_state::IsSet, + S::Id: event_state::IsSet, S::EventType: event_state::IsSet, - S::CreatedAt: event_state::IsSet, - S::Url: event_state::IsSet, - S::Pattern: event_state::IsSet, S::Reason: event_state::IsSet, - S::Id: event_state::IsSet, + S::CreatedBy: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { @@ -558,7 +564,7 @@ fn lexicon_doc_tools_ozone_safelink_defs() -> ::jacquard_lexicon::lexicon::Lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actionType"), ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { @@ -597,7 +603,7 @@ fn lexicon_doc_tools_ozone_safelink_defs() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -790,7 +796,7 @@ fn lexicon_doc_tools_ozone_safelink_defs() -> ::jacquard_lexicon::lexicon::Lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -940,7 +946,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -992,6 +998,12 @@ impl<'a> AsRef for EventType<'a> { } } +impl<'a> core::fmt::Display for EventType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for EventType<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1069,6 +1081,12 @@ impl<'a> AsRef for PatternType<'a> { } } +impl<'a> core::fmt::Display for PatternType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for PatternType<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1153,6 +1171,12 @@ impl<'a> AsRef for ReasonType<'a> { } } +impl<'a> core::fmt::Display for ReasonType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + impl<'a> serde::Serialize for ReasonType<'a> { fn serialize(&self, serializer: S) -> Result where @@ -1233,127 +1257,127 @@ pub mod url_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Action; type Url; - type Reason; type CreatedBy; type CreatedAt; - type UpdatedAt; type Pattern; + type Reason; + type UpdatedAt; + type Action; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Action = Unset; type Url = Unset; - type Reason = Unset; type CreatedBy = Unset; type CreatedAt = Unset; - type UpdatedAt = Unset; type Pattern = Unset; - } - ///State transition - sets the `action` field to Set - pub struct SetAction(PhantomData S>); - impl sealed::Sealed for SetAction {} - impl State for SetAction { - type Action = Set; - type Url = S::Url; - type Reason = S::Reason; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; - type Pattern = S::Pattern; + type Reason = Unset; + type UpdatedAt = Unset; + type Action = Unset; } ///State transition - sets the `url` field to Set pub struct SetUrl(PhantomData S>); impl sealed::Sealed for SetUrl {} impl State for SetUrl { - type Action = S::Action; type Url = Set; - type Reason = S::Reason; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Pattern = S::Pattern; - } - ///State transition - sets the `reason` field to Set - pub struct SetReason(PhantomData S>); - impl sealed::Sealed for SetReason {} - impl State for SetReason { - type Action = S::Action; - type Url = S::Url; - type Reason = Set; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; + type Reason = S::Reason; type UpdatedAt = S::UpdatedAt; - type Pattern = S::Pattern; + type Action = S::Action; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { - type Action = S::Action; type Url = S::Url; - type Reason = S::Reason; type CreatedBy = Set; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Pattern = S::Pattern; + type Reason = S::Reason; + type UpdatedAt = S::UpdatedAt; + type Action = S::Action; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { - type Action = S::Action; type Url = S::Url; - type Reason = S::Reason; type CreatedBy = S::CreatedBy; type CreatedAt = Set; + type Pattern = S::Pattern; + type Reason = S::Reason; type UpdatedAt = S::UpdatedAt; + type Action = S::Action; + } + ///State transition - sets the `pattern` field to Set + pub struct SetPattern(PhantomData S>); + impl sealed::Sealed for SetPattern {} + impl State for SetPattern { + type Url = S::Url; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Pattern = Set; + type Reason = S::Reason; + type UpdatedAt = S::UpdatedAt; + type Action = S::Action; + } + ///State transition - sets the `reason` field to Set + pub struct SetReason(PhantomData S>); + impl sealed::Sealed for SetReason {} + impl State for SetReason { + type Url = S::Url; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; type Pattern = S::Pattern; + type Reason = Set; + type UpdatedAt = S::UpdatedAt; + type Action = S::Action; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt(PhantomData S>); impl sealed::Sealed for SetUpdatedAt {} impl State for SetUpdatedAt { - type Action = S::Action; type Url = S::Url; - type Reason = S::Reason; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type UpdatedAt = Set; type Pattern = S::Pattern; - } - ///State transition - sets the `pattern` field to Set - pub struct SetPattern(PhantomData S>); - impl sealed::Sealed for SetPattern {} - impl State for SetPattern { + type Reason = S::Reason; + type UpdatedAt = Set; type Action = S::Action; + } + ///State transition - sets the `action` field to Set + pub struct SetAction(PhantomData S>); + impl sealed::Sealed for SetAction {} + impl State for SetAction { type Url = S::Url; - type Reason = S::Reason; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; + type Pattern = S::Pattern; + type Reason = S::Reason; type UpdatedAt = S::UpdatedAt; - type Pattern = Set; + type Action = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `action` field - pub struct action(()); ///Marker type for the `url` field pub struct url(()); - ///Marker type for the `reason` field - pub struct reason(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `pattern` field pub struct pattern(()); + ///Marker type for the `reason` field + pub struct reason(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); + ///Marker type for the `action` field + pub struct action(()); } } @@ -1543,13 +1567,13 @@ where impl<'a, S> UrlRuleBuilder<'a, S> where S: url_rule_state::State, - S::Action: url_rule_state::IsSet, S::Url: url_rule_state::IsSet, - S::Reason: url_rule_state::IsSet, S::CreatedBy: url_rule_state::IsSet, S::CreatedAt: url_rule_state::IsSet, - S::UpdatedAt: url_rule_state::IsSet, S::Pattern: url_rule_state::IsSet, + S::Reason: url_rule_state::IsSet, + S::UpdatedAt: url_rule_state::IsSet, + S::Action: url_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> UrlRule<'a> { @@ -1599,7 +1623,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UrlRule<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/safelink/add_rule.rs b/crates/weaver-api/src/tools_ozone/safelink/add_rule.rs index c5d7107..945ae73 100644 --- a/crates/weaver-api/src/tools_ozone/safelink/add_rule.rs +++ b/crates/weaver-api/src/tools_ozone/safelink/add_rule.rs @@ -46,67 +46,67 @@ pub mod add_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Action; + type Url; type Pattern; type Reason; - type Url; - type Action; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Action = Unset; + type Url = Unset; type Pattern = Unset; type Reason = Unset; - type Url = Unset; - type Action = Unset; + } + ///State transition - sets the `action` field to Set + pub struct SetAction(PhantomData S>); + impl sealed::Sealed for SetAction {} + impl State for SetAction { + type Action = Set; + type Url = S::Url; + type Pattern = S::Pattern; + type Reason = S::Reason; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl(PhantomData S>); + impl sealed::Sealed for SetUrl {} + impl State for SetUrl { + type Action = S::Action; + type Url = Set; + type Pattern = S::Pattern; + type Reason = S::Reason; } ///State transition - sets the `pattern` field to Set pub struct SetPattern(PhantomData S>); impl sealed::Sealed for SetPattern {} impl State for SetPattern { + type Action = S::Action; + type Url = S::Url; type Pattern = Set; type Reason = S::Reason; - type Url = S::Url; - type Action = S::Action; } ///State transition - sets the `reason` field to Set pub struct SetReason(PhantomData S>); impl sealed::Sealed for SetReason {} impl State for SetReason { - type Pattern = S::Pattern; - type Reason = Set; - type Url = S::Url; - type Action = S::Action; - } - ///State transition - sets the `url` field to Set - pub struct SetUrl(PhantomData S>); - impl sealed::Sealed for SetUrl {} - impl State for SetUrl { - type Pattern = S::Pattern; - type Reason = S::Reason; - type Url = Set; type Action = S::Action; - } - ///State transition - sets the `action` field to Set - pub struct SetAction(PhantomData S>); - impl sealed::Sealed for SetAction {} - impl State for SetAction { - type Pattern = S::Pattern; - type Reason = S::Reason; type Url = S::Url; - type Action = Set; + type Pattern = S::Pattern; + type Reason = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `action` field + pub struct action(()); + ///Marker type for the `url` field + pub struct url(()); ///Marker type for the `pattern` field pub struct pattern(()); ///Marker type for the `reason` field pub struct reason(()); - ///Marker type for the `url` field - pub struct url(()); - ///Marker type for the `action` field - pub struct action(()); } } @@ -256,10 +256,10 @@ where impl<'a, S> AddRuleBuilder<'a, S> where S: add_rule_state::State, + S::Action: add_rule_state::IsSet, + S::Url: add_rule_state::IsSet, S::Pattern: add_rule_state::IsSet, S::Reason: add_rule_state::IsSet, - S::Url: add_rule_state::IsSet, - S::Action: add_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> AddRule<'a> { @@ -333,8 +333,8 @@ pub enum AddRuleError<'a> { RuleAlreadyExists(std::option::Option>), } -impl std::fmt::Display for AddRuleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for AddRuleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidUrl(msg) => { write!(f, "InvalidUrl")?; diff --git a/crates/weaver-api/src/tools_ozone/safelink/query_events.rs b/crates/weaver-api/src/tools_ozone/safelink/query_events.rs index 04285a3..7bb5940 100644 --- a/crates/weaver-api/src/tools_ozone/safelink/query_events.rs +++ b/crates/weaver-api/src/tools_ozone/safelink/query_events.rs @@ -32,13 +32,104 @@ pub struct QueryEvents<'a> { /// Sort direction #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub sort_direction: std::option::Option>, + pub sort_direction: std::option::Option>, /// Filter by specific URLs or domains #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub urls: std::option::Option>>, } +/// Sort direction +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum QueryEventsSortDirection<'a> { + Asc, + Desc, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> QueryEventsSortDirection<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Asc => "asc", + Self::Desc => "desc", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for QueryEventsSortDirection<'a> { + fn from(s: &'a str) -> Self { + match s { + "asc" => Self::Asc, + "desc" => Self::Desc, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for QueryEventsSortDirection<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "asc" => Self::Asc, + "desc" => Self::Desc, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for QueryEventsSortDirection<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for QueryEventsSortDirection<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for QueryEventsSortDirection<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for QueryEventsSortDirection<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for QueryEventsSortDirection<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for QueryEventsSortDirection<'_> { + type Output = QueryEventsSortDirection<'static>; + fn into_static(self) -> Self::Output { + match self { + QueryEventsSortDirection::Asc => QueryEventsSortDirection::Asc, + QueryEventsSortDirection::Desc => QueryEventsSortDirection::Desc, + QueryEventsSortDirection::Other(v) => { + QueryEventsSortDirection::Other(v.into_static()) + } + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, diff --git a/crates/weaver-api/src/tools_ozone/safelink/query_rules.rs b/crates/weaver-api/src/tools_ozone/safelink/query_rules.rs index c9af39e..2ac5931 100644 --- a/crates/weaver-api/src/tools_ozone/safelink/query_rules.rs +++ b/crates/weaver-api/src/tools_ozone/safelink/query_rules.rs @@ -44,13 +44,104 @@ pub struct QueryRules<'a> { /// Sort direction #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub sort_direction: std::option::Option>, + pub sort_direction: std::option::Option>, /// Filter by specific URLs or domains #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub urls: std::option::Option>>, } +/// Sort direction +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum QueryRulesSortDirection<'a> { + Asc, + Desc, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> QueryRulesSortDirection<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Asc => "asc", + Self::Desc => "desc", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for QueryRulesSortDirection<'a> { + fn from(s: &'a str) -> Self { + match s { + "asc" => Self::Asc, + "desc" => Self::Desc, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for QueryRulesSortDirection<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "asc" => Self::Asc, + "desc" => Self::Desc, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for QueryRulesSortDirection<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for QueryRulesSortDirection<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for QueryRulesSortDirection<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for QueryRulesSortDirection<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for QueryRulesSortDirection<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for QueryRulesSortDirection<'_> { + type Output = QueryRulesSortDirection<'static>; + fn into_static(self) -> Self::Output { + match self { + QueryRulesSortDirection::Asc => QueryRulesSortDirection::Asc, + QueryRulesSortDirection::Desc => QueryRulesSortDirection::Desc, + QueryRulesSortDirection::Other(v) => { + QueryRulesSortDirection::Other(v.into_static()) + } + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, diff --git a/crates/weaver-api/src/tools_ozone/safelink/remove_rule.rs b/crates/weaver-api/src/tools_ozone/safelink/remove_rule.rs index c370f25..45dfdab 100644 --- a/crates/weaver-api/src/tools_ozone/safelink/remove_rule.rs +++ b/crates/weaver-api/src/tools_ozone/safelink/remove_rule.rs @@ -42,37 +42,37 @@ pub mod remove_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; type Pattern; + type Url; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; type Pattern = Unset; - } - ///State transition - sets the `url` field to Set - pub struct SetUrl(PhantomData S>); - impl sealed::Sealed for SetUrl {} - impl State for SetUrl { - type Url = Set; - type Pattern = S::Pattern; + type Url = Unset; } ///State transition - sets the `pattern` field to Set pub struct SetPattern(PhantomData S>); impl sealed::Sealed for SetPattern {} impl State for SetPattern { - type Url = S::Url; type Pattern = Set; + type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl(PhantomData S>); + impl sealed::Sealed for SetUrl {} + impl State for SetUrl { + type Pattern = S::Pattern; + type Url = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); ///Marker type for the `pattern` field pub struct pattern(()); + ///Marker type for the `url` field + pub struct url(()); } } @@ -182,8 +182,8 @@ where impl<'a, S> RemoveRuleBuilder<'a, S> where S: remove_rule_state::State, - S::Url: remove_rule_state::IsSet, S::Pattern: remove_rule_state::IsSet, + S::Url: remove_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> RemoveRule<'a> { @@ -250,8 +250,8 @@ pub enum RemoveRuleError<'a> { RuleNotFound(std::option::Option>), } -impl std::fmt::Display for RemoveRuleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for RemoveRuleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RuleNotFound(msg) => { write!(f, "RuleNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/safelink/update_rule.rs b/crates/weaver-api/src/tools_ozone/safelink/update_rule.rs index f9e878c..6473a09 100644 --- a/crates/weaver-api/src/tools_ozone/safelink/update_rule.rs +++ b/crates/weaver-api/src/tools_ozone/safelink/update_rule.rs @@ -46,67 +46,67 @@ pub mod update_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Action; type Pattern; type Reason; type Url; - type Action; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Action = Unset; type Pattern = Unset; type Reason = Unset; type Url = Unset; - type Action = Unset; + } + ///State transition - sets the `action` field to Set + pub struct SetAction(PhantomData S>); + impl sealed::Sealed for SetAction {} + impl State for SetAction { + type Action = Set; + type Pattern = S::Pattern; + type Reason = S::Reason; + type Url = S::Url; } ///State transition - sets the `pattern` field to Set pub struct SetPattern(PhantomData S>); impl sealed::Sealed for SetPattern {} impl State for SetPattern { + type Action = S::Action; type Pattern = Set; type Reason = S::Reason; type Url = S::Url; - type Action = S::Action; } ///State transition - sets the `reason` field to Set pub struct SetReason(PhantomData S>); impl sealed::Sealed for SetReason {} impl State for SetReason { + type Action = S::Action; type Pattern = S::Pattern; type Reason = Set; type Url = S::Url; - type Action = S::Action; } ///State transition - sets the `url` field to Set pub struct SetUrl(PhantomData S>); impl sealed::Sealed for SetUrl {} impl State for SetUrl { - type Pattern = S::Pattern; - type Reason = S::Reason; - type Url = Set; type Action = S::Action; - } - ///State transition - sets the `action` field to Set - pub struct SetAction(PhantomData S>); - impl sealed::Sealed for SetAction {} - impl State for SetAction { type Pattern = S::Pattern; type Reason = S::Reason; - type Url = S::Url; - type Action = Set; + type Url = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `action` field + pub struct action(()); ///Marker type for the `pattern` field pub struct pattern(()); ///Marker type for the `reason` field pub struct reason(()); ///Marker type for the `url` field pub struct url(()); - ///Marker type for the `action` field - pub struct action(()); } } @@ -256,10 +256,10 @@ where impl<'a, S> UpdateRuleBuilder<'a, S> where S: update_rule_state::State, + S::Action: update_rule_state::IsSet, S::Pattern: update_rule_state::IsSet, S::Reason: update_rule_state::IsSet, S::Url: update_rule_state::IsSet, - S::Action: update_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateRule<'a> { @@ -330,8 +330,8 @@ pub enum UpdateRuleError<'a> { RuleNotFound(std::option::Option>), } -impl std::fmt::Display for UpdateRuleError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for UpdateRuleError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::RuleNotFound(msg) => { write!(f, "RuleNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/server/get_config.rs b/crates/weaver-api/src/tools_ozone/server/get_config.rs index 00b235c..682f615 100644 --- a/crates/weaver-api/src/tools_ozone/server/get_config.rs +++ b/crates/weaver-api/src/tools_ozone/server/get_config.rs @@ -114,7 +114,7 @@ fn lexicon_doc_tools_ozone_server_getConfig() -> ::jacquard_lexicon::lexicon::Le revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -132,7 +132,7 @@ fn lexicon_doc_tools_ozone_server_getConfig() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("url"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -162,7 +162,7 @@ fn lexicon_doc_tools_ozone_server_getConfig() -> ::jacquard_lexicon::lexicon::Le nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("role"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -199,7 +199,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ServiceConfig<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -219,7 +219,105 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ServiceConfig<'a> { pub struct ViewerConfig<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub role: std::option::Option>, + pub role: std::option::Option>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ViewerConfigRole<'a> { + RoleAdmin, + RoleModerator, + RoleTriage, + RoleVerifier, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ViewerConfigRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ViewerConfigRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for ViewerConfigRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ViewerConfigRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for ViewerConfigRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ViewerConfigRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ViewerConfigRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ViewerConfigRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ViewerConfigRole<'_> { + type Output = ViewerConfigRole<'static>; + fn into_static(self) -> Self::Output { + match self { + ViewerConfigRole::RoleAdmin => ViewerConfigRole::RoleAdmin, + ViewerConfigRole::RoleModerator => ViewerConfigRole::RoleModerator, + ViewerConfigRole::RoleTriage => ViewerConfigRole::RoleTriage, + ViewerConfigRole::RoleVerifier => ViewerConfigRole::RoleVerifier, + ViewerConfigRole::Other(v) => ViewerConfigRole::Other(v.into_static()), + } + } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerConfig<'a> { @@ -234,7 +332,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewerConfig<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/set.rs b/crates/weaver-api/src/tools_ozone/set.rs index c13c1c2..974fde5 100644 --- a/crates/weaver-api/src/tools_ozone/set.rs +++ b/crates/weaver-api/src/tools_ozone/set.rs @@ -41,7 +41,7 @@ fn lexicon_doc_tools_ozone_set_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("set"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -52,7 +52,7 @@ fn lexicon_doc_tools_ozone_set_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "description", @@ -104,7 +104,7 @@ fn lexicon_doc_tools_ozone_set_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -207,7 +207,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Set<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10240usize { @@ -300,67 +300,67 @@ pub mod set_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Name; type SetSize; + type Name; type UpdatedAt; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Name = Unset; type SetSize = Unset; + type Name = Unset; type UpdatedAt = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { - type CreatedAt = Set; + ///State transition - sets the `set_size` field to Set + pub struct SetSetSize(PhantomData S>); + impl sealed::Sealed for SetSetSize {} + impl State for SetSetSize { + type SetSize = Set; type Name = S::Name; - type SetSize = S::SetSize; type UpdatedAt = S::UpdatedAt; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { - type CreatedAt = S::CreatedAt; - type Name = Set; type SetSize = S::SetSize; + type Name = Set; type UpdatedAt = S::UpdatedAt; - } - ///State transition - sets the `set_size` field to Set - pub struct SetSetSize(PhantomData S>); - impl sealed::Sealed for SetSetSize {} - impl State for SetSetSize { type CreatedAt = S::CreatedAt; - type Name = S::Name; - type SetSize = Set; - type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt(PhantomData S>); impl sealed::Sealed for SetUpdatedAt {} impl State for SetUpdatedAt { - type CreatedAt = S::CreatedAt; - type Name = S::Name; type SetSize = S::SetSize; + type Name = S::Name; type UpdatedAt = Set; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type SetSize = S::SetSize; + type Name = S::Name; + type UpdatedAt = S::UpdatedAt; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `set_size` field pub struct set_size(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `updated_at` field pub struct updated_at(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -493,10 +493,10 @@ where impl<'a, S> SetViewBuilder<'a, S> where S: set_view_state::State, - S::CreatedAt: set_view_state::IsSet, - S::Name: set_view_state::IsSet, S::SetSize: set_view_state::IsSet, + S::Name: set_view_state::IsSet, S::UpdatedAt: set_view_state::IsSet, + S::CreatedAt: set_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SetView<'a> { @@ -540,7 +540,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SetView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10240usize { diff --git a/crates/weaver-api/src/tools_ozone/set/delete_set.rs b/crates/weaver-api/src/tools_ozone/set/delete_set.rs index 60b626d..84d5f91 100644 --- a/crates/weaver-api/src/tools_ozone/set/delete_set.rs +++ b/crates/weaver-api/src/tools_ozone/set/delete_set.rs @@ -56,8 +56,8 @@ pub enum DeleteSetError<'a> { SetNotFound(std::option::Option>), } -impl std::fmt::Display for DeleteSetError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteSetError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::SetNotFound(msg) => { write!(f, "SetNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/set/delete_values.rs b/crates/weaver-api/src/tools_ozone/set/delete_values.rs index 41bead7..b8a9c48 100644 --- a/crates/weaver-api/src/tools_ozone/set/delete_values.rs +++ b/crates/weaver-api/src/tools_ozone/set/delete_values.rs @@ -35,37 +35,37 @@ pub mod delete_values_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Values; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Values = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName(PhantomData S>); - impl sealed::Sealed for SetName {} - impl State for SetName { - type Name = Set; - type Values = S::Values; + type Name = Unset; } ///State transition - sets the `values` field to Set pub struct SetValues(PhantomData S>); impl sealed::Sealed for SetValues {} impl State for SetValues { - type Name = S::Name; type Values = Set; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData S>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Values = S::Values; + type Name = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `values` field pub struct values(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> DeleteValuesBuilder<'a, S> where S: delete_values_state::State, - S::Name: delete_values_state::IsSet, S::Values: delete_values_state::IsSet, + S::Name: delete_values_state::IsSet, { /// Build the final struct pub fn build(self) -> DeleteValues<'a> { @@ -185,8 +185,8 @@ pub enum DeleteValuesError<'a> { SetNotFound(std::option::Option>), } -impl std::fmt::Display for DeleteValuesError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteValuesError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::SetNotFound(msg) => { write!(f, "SetNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/set/get_values.rs b/crates/weaver-api/src/tools_ozone/set/get_values.rs index 793799a..f877f9e 100644 --- a/crates/weaver-api/src/tools_ozone/set/get_values.rs +++ b/crates/weaver-api/src/tools_ozone/set/get_values.rs @@ -191,8 +191,8 @@ pub enum GetValuesError<'a> { SetNotFound(std::option::Option>), } -impl std::fmt::Display for GetValuesError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for GetValuesError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::SetNotFound(msg) => { write!(f, "SetNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/setting.rs b/crates/weaver-api/src/tools_ozone/setting.rs index 87b1eed..ffc11bb 100644 --- a/crates/weaver-api/src/tools_ozone/setting.rs +++ b/crates/weaver-api/src/tools_ozone/setting.rs @@ -36,9 +36,9 @@ pub struct DefsOption<'a> { pub last_updated_by: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub manager_role: std::option::Option>, + pub manager_role: std::option::Option>, #[serde(borrow)] - pub scope: jacquard_common::CowStr<'a>, + pub scope: DefsOptionScope<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, #[serde(borrow)] @@ -55,105 +55,105 @@ pub mod defs_option_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Scope; type Key; - type Value; type Did; - type Scope; - type CreatedBy; type LastUpdatedBy; + type CreatedBy; + type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Scope = Unset; type Key = Unset; - type Value = Unset; type Did = Unset; - type Scope = Unset; - type CreatedBy = Unset; type LastUpdatedBy = Unset; + type CreatedBy = Unset; + type Value = Unset; + } + ///State transition - sets the `scope` field to Set + pub struct SetScope(PhantomData S>); + impl sealed::Sealed for SetScope {} + impl State for SetScope { + type Scope = Set; + type Key = S::Key; + type Did = S::Did; + type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = S::CreatedBy; + type Value = S::Value; } ///State transition - sets the `key` field to Set pub struct SetKey(PhantomData S>); impl sealed::Sealed for SetKey {} impl State for SetKey { + type Scope = S::Scope; type Key = Set; - type Value = S::Value; type Did = S::Did; - type Scope = S::Scope; - type CreatedBy = S::CreatedBy; type LastUpdatedBy = S::LastUpdatedBy; - } - ///State transition - sets the `value` field to Set - pub struct SetValue(PhantomData S>); - impl sealed::Sealed for SetValue {} - impl State for SetValue { - type Key = S::Key; - type Value = Set; - type Did = S::Did; - type Scope = S::Scope; type CreatedBy = S::CreatedBy; - type LastUpdatedBy = S::LastUpdatedBy; + type Value = S::Value; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { + type Scope = S::Scope; type Key = S::Key; - type Value = S::Value; type Did = Set; - type Scope = S::Scope; - type CreatedBy = S::CreatedBy; type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = S::CreatedBy; + type Value = S::Value; } - ///State transition - sets the `scope` field to Set - pub struct SetScope(PhantomData S>); - impl sealed::Sealed for SetScope {} - impl State for SetScope { + ///State transition - sets the `last_updated_by` field to Set + pub struct SetLastUpdatedBy(PhantomData S>); + impl sealed::Sealed for SetLastUpdatedBy {} + impl State for SetLastUpdatedBy { + type Scope = S::Scope; type Key = S::Key; - type Value = S::Value; type Did = S::Did; - type Scope = Set; + type LastUpdatedBy = Set; type CreatedBy = S::CreatedBy; - type LastUpdatedBy = S::LastUpdatedBy; + type Value = S::Value; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { + type Scope = S::Scope; type Key = S::Key; - type Value = S::Value; type Did = S::Did; - type Scope = S::Scope; - type CreatedBy = Set; type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = Set; + type Value = S::Value; } - ///State transition - sets the `last_updated_by` field to Set - pub struct SetLastUpdatedBy(PhantomData S>); - impl sealed::Sealed for SetLastUpdatedBy {} - impl State for SetLastUpdatedBy { + ///State transition - sets the `value` field to Set + pub struct SetValue(PhantomData S>); + impl sealed::Sealed for SetValue {} + impl State for SetValue { + type Scope = S::Scope; type Key = S::Key; - type Value = S::Value; type Did = S::Did; - type Scope = S::Scope; + type LastUpdatedBy = S::LastUpdatedBy; type CreatedBy = S::CreatedBy; - type LastUpdatedBy = Set; + type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `scope` field + pub struct scope(()); ///Marker type for the `key` field pub struct key(()); - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `scope` field - pub struct scope(()); - ///Marker type for the `created_by` field - pub struct created_by(()); ///Marker type for the `last_updated_by` field pub struct last_updated_by(()); + ///Marker type for the `created_by` field + pub struct created_by(()); + ///Marker type for the `value` field + pub struct value(()); } } @@ -167,8 +167,8 @@ pub struct DefsOptionBuilder<'a, S: defs_option_state::State> { ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ), @@ -322,7 +322,7 @@ impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { /// Set the `managerRole` field (optional) pub fn manager_role( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.6 = value.into(); self @@ -330,7 +330,7 @@ impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { /// Set the `managerRole` field to an Option value (optional) pub fn maybe_manager_role( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.6 = value; self @@ -345,7 +345,7 @@ where /// Set the `scope` field (required) pub fn scope( mut self, - value: impl Into>, + value: impl Into>, ) -> DefsOptionBuilder<'a, defs_option_state::SetScope> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); DefsOptionBuilder { @@ -397,12 +397,12 @@ where impl<'a, S> DefsOptionBuilder<'a, S> where S: defs_option_state::State, + S::Scope: defs_option_state::IsSet, S::Key: defs_option_state::IsSet, - S::Value: defs_option_state::IsSet, S::Did: defs_option_state::IsSet, - S::Scope: defs_option_state::IsSet, - S::CreatedBy: defs_option_state::IsSet, S::LastUpdatedBy: defs_option_state::IsSet, + S::CreatedBy: defs_option_state::IsSet, + S::Value: defs_option_state::IsSet, { /// Build the final struct pub fn build(self) -> DefsOption<'a> { @@ -444,6 +444,194 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum DefsOptionManagerRole<'a> { + RoleModerator, + RoleTriage, + RoleAdmin, + RoleVerifier, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> DefsOptionManagerRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for DefsOptionManagerRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for DefsOptionManagerRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for DefsOptionManagerRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for DefsOptionManagerRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for DefsOptionManagerRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for DefsOptionManagerRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for DefsOptionManagerRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for DefsOptionManagerRole<'_> { + type Output = DefsOptionManagerRole<'static>; + fn into_static(self) -> Self::Output { + match self { + DefsOptionManagerRole::RoleModerator => DefsOptionManagerRole::RoleModerator, + DefsOptionManagerRole::RoleTriage => DefsOptionManagerRole::RoleTriage, + DefsOptionManagerRole::RoleAdmin => DefsOptionManagerRole::RoleAdmin, + DefsOptionManagerRole::RoleVerifier => DefsOptionManagerRole::RoleVerifier, + DefsOptionManagerRole::Other(v) => { + DefsOptionManagerRole::Other(v.into_static()) + } + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum DefsOptionScope<'a> { + Instance, + Personal, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> DefsOptionScope<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Instance => "instance", + Self::Personal => "personal", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for DefsOptionScope<'a> { + fn from(s: &'a str) -> Self { + match s { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for DefsOptionScope<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for DefsOptionScope<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for DefsOptionScope<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for DefsOptionScope<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for DefsOptionScope<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for DefsOptionScope<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for DefsOptionScope<'_> { + type Output = DefsOptionScope<'static>; + fn into_static(self) -> Self::Output { + match self { + DefsOptionScope::Instance => DefsOptionScope::Instance, + DefsOptionScope::Personal => DefsOptionScope::Personal, + DefsOptionScope::Other(v) => DefsOptionScope::Other(v.into_static()), + } + } +} + fn lexicon_doc_tools_ozone_setting_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -453,7 +641,7 @@ fn lexicon_doc_tools_ozone_setting_defs() -> ::jacquard_lexicon::lexicon::Lexico revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("option"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -471,7 +659,7 @@ fn lexicon_doc_tools_ozone_setting_defs() -> ::jacquard_lexicon::lexicon::Lexico nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -658,7 +846,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DefsOption<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 10240usize { diff --git a/crates/weaver-api/src/tools_ozone/setting/remove_options.rs b/crates/weaver-api/src/tools_ozone/setting/remove_options.rs index 70b0fdf..b1234e5 100644 --- a/crates/weaver-api/src/tools_ozone/setting/remove_options.rs +++ b/crates/weaver-api/src/tools_ozone/setting/remove_options.rs @@ -20,7 +20,7 @@ pub struct RemoveOptions<'a> { #[serde(borrow)] pub keys: Vec>, #[serde(borrow)] - pub scope: jacquard_common::CowStr<'a>, + pub scope: RemoveOptionsScope<'a>, } pub mod remove_options_state { @@ -33,37 +33,37 @@ pub mod remove_options_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Keys; type Scope; + type Keys; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Keys = Unset; type Scope = Unset; - } - ///State transition - sets the `keys` field to Set - pub struct SetKeys(PhantomData S>); - impl sealed::Sealed for SetKeys {} - impl State for SetKeys { - type Keys = Set; - type Scope = S::Scope; + type Keys = Unset; } ///State transition - sets the `scope` field to Set pub struct SetScope(PhantomData S>); impl sealed::Sealed for SetScope {} impl State for SetScope { - type Keys = S::Keys; type Scope = Set; + type Keys = S::Keys; + } + ///State transition - sets the `keys` field to Set + pub struct SetKeys(PhantomData S>); + impl sealed::Sealed for SetKeys {} + impl State for SetKeys { + type Scope = S::Scope; + type Keys = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `keys` field - pub struct keys(()); ///Marker type for the `scope` field pub struct scope(()); + ///Marker type for the `keys` field + pub struct keys(()); } } @@ -72,7 +72,7 @@ pub struct RemoveOptionsBuilder<'a, S: remove_options_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -122,7 +122,7 @@ where /// Set the `scope` field (required) pub fn scope( mut self, - value: impl Into>, + value: impl Into>, ) -> RemoveOptionsBuilder<'a, remove_options_state::SetScope> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); RemoveOptionsBuilder { @@ -136,8 +136,8 @@ where impl<'a, S> RemoveOptionsBuilder<'a, S> where S: remove_options_state::State, - S::Keys: remove_options_state::IsSet, S::Scope: remove_options_state::IsSet, + S::Keys: remove_options_state::IsSet, { /// Build the final struct pub fn build(self) -> RemoveOptions<'a> { @@ -163,6 +163,94 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum RemoveOptionsScope<'a> { + Instance, + Personal, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> RemoveOptionsScope<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Instance => "instance", + Self::Personal => "personal", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for RemoveOptionsScope<'a> { + fn from(s: &'a str) -> Self { + match s { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for RemoveOptionsScope<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for RemoveOptionsScope<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for RemoveOptionsScope<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for RemoveOptionsScope<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for RemoveOptionsScope<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for RemoveOptionsScope<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for RemoveOptionsScope<'_> { + type Output = RemoveOptionsScope<'static>; + fn into_static(self) -> Self::Output { + match self { + RemoveOptionsScope::Instance => RemoveOptionsScope::Instance, + RemoveOptionsScope::Personal => RemoveOptionsScope::Personal, + RemoveOptionsScope::Other(v) => RemoveOptionsScope::Other(v.into_static()), + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, diff --git a/crates/weaver-api/src/tools_ozone/setting/upsert_option.rs b/crates/weaver-api/src/tools_ozone/setting/upsert_option.rs index 5651b97..4da22d4 100644 --- a/crates/weaver-api/src/tools_ozone/setting/upsert_option.rs +++ b/crates/weaver-api/src/tools_ozone/setting/upsert_option.rs @@ -24,9 +24,9 @@ pub struct UpsertOption<'a> { pub key: jacquard_common::types::string::Nsid<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub manager_role: std::option::Option>, + pub manager_role: std::option::Option>, #[serde(borrow)] - pub scope: jacquard_common::CowStr<'a>, + pub scope: UpsertOptionScope<'a>, #[serde(borrow)] pub value: jacquard_common::types::value::Data<'a>, } @@ -41,49 +41,49 @@ pub mod upsert_option_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Scope; type Key; + type Scope; type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Scope = Unset; type Key = Unset; + type Scope = Unset; type Value = Unset; } - ///State transition - sets the `scope` field to Set - pub struct SetScope(PhantomData S>); - impl sealed::Sealed for SetScope {} - impl State for SetScope { - type Scope = Set; - type Key = S::Key; - type Value = S::Value; - } ///State transition - sets the `key` field to Set pub struct SetKey(PhantomData S>); impl sealed::Sealed for SetKey {} impl State for SetKey { - type Scope = S::Scope; type Key = Set; + type Scope = S::Scope; + type Value = S::Value; + } + ///State transition - sets the `scope` field to Set + pub struct SetScope(PhantomData S>); + impl sealed::Sealed for SetScope {} + impl State for SetScope { + type Key = S::Key; + type Scope = Set; type Value = S::Value; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { - type Scope = S::Scope; type Key = S::Key; + type Scope = S::Scope; type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `scope` field - pub struct scope(()); ///Marker type for the `key` field pub struct key(()); + ///Marker type for the `scope` field + pub struct scope(()); ///Marker type for the `value` field pub struct value(()); } @@ -95,8 +95,8 @@ pub struct UpsertOptionBuilder<'a, S: upsert_option_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, + ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -162,7 +162,7 @@ impl<'a, S: upsert_option_state::State> UpsertOptionBuilder<'a, S> { /// Set the `managerRole` field (optional) pub fn manager_role( mut self, - value: impl Into>>, + value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self @@ -170,7 +170,7 @@ impl<'a, S: upsert_option_state::State> UpsertOptionBuilder<'a, S> { /// Set the `managerRole` field to an Option value (optional) pub fn maybe_manager_role( mut self, - value: Option>, + value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self @@ -185,7 +185,7 @@ where /// Set the `scope` field (required) pub fn scope( mut self, - value: impl Into>, + value: impl Into>, ) -> UpsertOptionBuilder<'a, upsert_option_state::SetScope> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); UpsertOptionBuilder { @@ -218,8 +218,8 @@ where impl<'a, S> UpsertOptionBuilder<'a, S> where S: upsert_option_state::State, - S::Scope: upsert_option_state::IsSet, S::Key: upsert_option_state::IsSet, + S::Scope: upsert_option_state::IsSet, S::Value: upsert_option_state::IsSet, { /// Build the final struct @@ -252,6 +252,198 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpsertOptionManagerRole<'a> { + RoleModerator, + RoleTriage, + RoleVerifier, + RoleAdmin, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpsertOptionManagerRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UpsertOptionManagerRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpsertOptionManagerRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpsertOptionManagerRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpsertOptionManagerRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpsertOptionManagerRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpsertOptionManagerRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpsertOptionManagerRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpsertOptionManagerRole<'_> { + type Output = UpsertOptionManagerRole<'static>; + fn into_static(self) -> Self::Output { + match self { + UpsertOptionManagerRole::RoleModerator => { + UpsertOptionManagerRole::RoleModerator + } + UpsertOptionManagerRole::RoleTriage => UpsertOptionManagerRole::RoleTriage, + UpsertOptionManagerRole::RoleVerifier => { + UpsertOptionManagerRole::RoleVerifier + } + UpsertOptionManagerRole::RoleAdmin => UpsertOptionManagerRole::RoleAdmin, + UpsertOptionManagerRole::Other(v) => { + UpsertOptionManagerRole::Other(v.into_static()) + } + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpsertOptionScope<'a> { + Instance, + Personal, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpsertOptionScope<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Instance => "instance", + Self::Personal => "personal", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UpsertOptionScope<'a> { + fn from(s: &'a str) -> Self { + match s { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpsertOptionScope<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "instance" => Self::Instance, + "personal" => Self::Personal, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpsertOptionScope<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpsertOptionScope<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpsertOptionScope<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpsertOptionScope<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpsertOptionScope<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpsertOptionScope<'_> { + type Output = UpsertOptionScope<'static>; + fn into_static(self) -> Self::Output { + match self { + UpsertOptionScope::Instance => UpsertOptionScope::Instance, + UpsertOptionScope::Personal => UpsertOptionScope::Personal, + UpsertOptionScope::Other(v) => UpsertOptionScope::Other(v.into_static()), + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, diff --git a/crates/weaver-api/src/tools_ozone/signature.rs b/crates/weaver-api/src/tools_ozone/signature.rs index 2db98ab..a240d30 100644 --- a/crates/weaver-api/src/tools_ozone/signature.rs +++ b/crates/weaver-api/src/tools_ozone/signature.rs @@ -37,7 +37,7 @@ fn lexicon_doc_tools_ozone_signature_defs() -> ::jacquard_lexicon::lexicon::Lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("sigDetail"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -51,7 +51,7 @@ fn lexicon_doc_tools_ozone_signature_defs() -> ::jacquard_lexicon::lexicon::Lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("property"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -103,7 +103,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SigDetail<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/signature/find_related_accounts.rs b/crates/weaver-api/src/tools_ozone/signature/find_related_accounts.rs index 002d271..453d905 100644 --- a/crates/weaver-api/src/tools_ozone/signature/find_related_accounts.rs +++ b/crates/weaver-api/src/tools_ozone/signature/find_related_accounts.rs @@ -356,7 +356,7 @@ fn lexicon_doc_tools_ozone_signature_findRelatedAccounts() -> ::jacquard_lexicon revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { @@ -371,7 +371,7 @@ fn lexicon_doc_tools_ozone_signature_findRelatedAccounts() -> ::jacquard_lexicon ), properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -433,7 +433,7 @@ fn lexicon_doc_tools_ozone_signature_findRelatedAccounts() -> ::jacquard_lexicon nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("account"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { @@ -480,7 +480,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RelatedAccount<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/team.rs b/crates/weaver-api/src/tools_ozone/team.rs index 51545dc..3f3adbd 100644 --- a/crates/weaver-api/src/tools_ozone/team.rs +++ b/crates/weaver-api/src/tools_ozone/team.rs @@ -35,7 +35,7 @@ pub struct Member<'a> { #[serde(borrow)] pub profile: std::option::Option>, #[serde(borrow)] - pub role: jacquard_common::CowStr<'a>, + pub role: MemberRole<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, } @@ -93,7 +93,7 @@ pub struct MemberBuilder<'a, S: member_state::State> { ::core::option::Option, ::core::option::Option>, ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, @@ -214,7 +214,7 @@ where /// Set the `role` field (required) pub fn role( mut self, - value: impl Into>, + value: impl Into>, ) -> MemberBuilder<'a, member_state::SetRole> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); MemberBuilder { @@ -284,6 +284,104 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum MemberRole<'a> { + RoleAdmin, + RoleModerator, + RoleTriage, + RoleVerifier, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> MemberRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for MemberRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for MemberRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for MemberRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for MemberRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for MemberRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for MemberRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for MemberRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for MemberRole<'_> { + type Output = MemberRole<'static>; + fn into_static(self) -> Self::Output { + match self { + MemberRole::RoleAdmin => MemberRole::RoleAdmin, + MemberRole::RoleModerator => MemberRole::RoleModerator, + MemberRole::RoleTriage => MemberRole::RoleTriage, + MemberRole::RoleVerifier => MemberRole::RoleVerifier, + MemberRole::Other(v) => MemberRole::Other(v.into_static()), + } + } +} + fn lexicon_doc_tools_ozone_team_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { @@ -293,7 +391,7 @@ fn lexicon_doc_tools_ozone_team_defs() -> ::jacquard_lexicon::lexicon::LexiconDo revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("member"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -307,7 +405,7 @@ fn lexicon_doc_tools_ozone_team_defs() -> ::jacquard_lexicon::lexicon::LexiconDo nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -457,7 +555,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Member<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } diff --git a/crates/weaver-api/src/tools_ozone/team/add_member.rs b/crates/weaver-api/src/tools_ozone/team/add_member.rs index 3542f77..e2de037 100644 --- a/crates/weaver-api/src/tools_ozone/team/add_member.rs +++ b/crates/weaver-api/src/tools_ozone/team/add_member.rs @@ -20,7 +20,7 @@ pub struct AddMember<'a> { #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, #[serde(borrow)] - pub role: jacquard_common::CowStr<'a>, + pub role: AddMemberRole<'a>, } pub mod add_member_state { @@ -72,7 +72,7 @@ pub struct AddMemberBuilder<'a, S: add_member_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -122,7 +122,7 @@ where /// Set the `role` field (required) pub fn role( mut self, - value: impl Into>, + value: impl Into>, ) -> AddMemberBuilder<'a, add_member_state::SetRole> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); AddMemberBuilder { @@ -163,6 +163,104 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AddMemberRole<'a> { + RoleAdmin, + RoleModerator, + RoleVerifier, + RoleTriage, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> AddMemberRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for AddMemberRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for AddMemberRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for AddMemberRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for AddMemberRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for AddMemberRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for AddMemberRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for AddMemberRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for AddMemberRole<'_> { + type Output = AddMemberRole<'static>; + fn into_static(self) -> Self::Output { + match self { + AddMemberRole::RoleAdmin => AddMemberRole::RoleAdmin, + AddMemberRole::RoleModerator => AddMemberRole::RoleModerator, + AddMemberRole::RoleVerifier => AddMemberRole::RoleVerifier, + AddMemberRole::RoleTriage => AddMemberRole::RoleTriage, + AddMemberRole::Other(v) => AddMemberRole::Other(v.into_static()), + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -200,8 +298,8 @@ pub enum AddMemberError<'a> { MemberAlreadyExists(std::option::Option>), } -impl std::fmt::Display for AddMemberError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for AddMemberError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::MemberAlreadyExists(msg) => { write!(f, "MemberAlreadyExists")?; diff --git a/crates/weaver-api/src/tools_ozone/team/delete_member.rs b/crates/weaver-api/src/tools_ozone/team/delete_member.rs index f339b4c..6764ad0 100644 --- a/crates/weaver-api/src/tools_ozone/team/delete_member.rs +++ b/crates/weaver-api/src/tools_ozone/team/delete_member.rs @@ -149,8 +149,8 @@ pub enum DeleteMemberError<'a> { CannotDeleteSelf(std::option::Option>), } -impl std::fmt::Display for DeleteMemberError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for DeleteMemberError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::MemberNotFound(msg) => { write!(f, "MemberNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/team/update_member.rs b/crates/weaver-api/src/tools_ozone/team/update_member.rs index fabfce2..6841f0d 100644 --- a/crates/weaver-api/src/tools_ozone/team/update_member.rs +++ b/crates/weaver-api/src/tools_ozone/team/update_member.rs @@ -23,7 +23,7 @@ pub struct UpdateMember<'a> { pub disabled: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub role: std::option::Option>, + pub role: std::option::Option>, } pub mod update_member_state { @@ -64,7 +64,7 @@ pub struct UpdateMemberBuilder<'a, S: update_member_state::State> { __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, - ::core::option::Option>, + ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -121,15 +121,12 @@ impl<'a, S: update_member_state::State> UpdateMemberBuilder<'a, S> { impl<'a, S: update_member_state::State> UpdateMemberBuilder<'a, S> { /// Set the `role` field (optional) - pub fn role( - mut self, - value: impl Into>>, - ) -> Self { + pub fn role(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `role` field to an Option value (optional) - pub fn maybe_role(mut self, value: Option>) -> Self { + pub fn maybe_role(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } @@ -166,6 +163,104 @@ where } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum UpdateMemberRole<'a> { + RoleAdmin, + RoleModerator, + RoleVerifier, + RoleTriage, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> UpdateMemberRole<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::RoleAdmin => "tools.ozone.team.defs#roleAdmin", + Self::RoleModerator => "tools.ozone.team.defs#roleModerator", + Self::RoleVerifier => "tools.ozone.team.defs#roleVerifier", + Self::RoleTriage => "tools.ozone.team.defs#roleTriage", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for UpdateMemberRole<'a> { + fn from(s: &'a str) -> Self { + match s { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From for UpdateMemberRole<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "tools.ozone.team.defs#roleAdmin" => Self::RoleAdmin, + "tools.ozone.team.defs#roleModerator" => Self::RoleModerator, + "tools.ozone.team.defs#roleVerifier" => Self::RoleVerifier, + "tools.ozone.team.defs#roleTriage" => Self::RoleTriage, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for UpdateMemberRole<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef for UpdateMemberRole<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for UpdateMemberRole<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for UpdateMemberRole<'a> +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for UpdateMemberRole<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for UpdateMemberRole<'_> { + type Output = UpdateMemberRole<'static>; + fn into_static(self) -> Self::Output { + match self { + UpdateMemberRole::RoleAdmin => UpdateMemberRole::RoleAdmin, + UpdateMemberRole::RoleModerator => UpdateMemberRole::RoleModerator, + UpdateMemberRole::RoleVerifier => UpdateMemberRole::RoleVerifier, + UpdateMemberRole::RoleTriage => UpdateMemberRole::RoleTriage, + UpdateMemberRole::Other(v) => UpdateMemberRole::Other(v.into_static()), + } + } +} + #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -203,8 +298,8 @@ pub enum UpdateMemberError<'a> { MemberNotFound(std::option::Option>), } -impl std::fmt::Display for UpdateMemberError<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Display for UpdateMemberError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::MemberNotFound(msg) => { write!(f, "MemberNotFound")?; diff --git a/crates/weaver-api/src/tools_ozone/verification.rs b/crates/weaver-api/src/tools_ozone/verification.rs index 6e2c255..ab3a9ba 100644 --- a/crates/weaver-api/src/tools_ozone/verification.rs +++ b/crates/weaver-api/src/tools_ozone/verification.rs @@ -74,105 +74,105 @@ pub mod verification_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Issuer; - type Uri; type Subject; type Handle; - type CreatedAt; + type Uri; type DisplayName; + type Issuer; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Issuer = Unset; - type Uri = Unset; type Subject = Unset; type Handle = Unset; - type CreatedAt = Unset; + type Uri = Unset; type DisplayName = Unset; - } - ///State transition - sets the `issuer` field to Set - pub struct SetIssuer(PhantomData S>); - impl sealed::Sealed for SetIssuer {} - impl State for SetIssuer { - type Issuer = Set; - type Uri = S::Uri; - type Subject = S::Subject; - type Handle = S::Handle; - type CreatedAt = S::CreatedAt; - type DisplayName = S::DisplayName; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Issuer = S::Issuer; - type Uri = Set; - type Subject = S::Subject; - type Handle = S::Handle; - type CreatedAt = S::CreatedAt; - type DisplayName = S::DisplayName; + type Issuer = Unset; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { - type Issuer = S::Issuer; - type Uri = S::Uri; type Subject = Set; type Handle = S::Handle; - type CreatedAt = S::CreatedAt; + type Uri = S::Uri; type DisplayName = S::DisplayName; + type Issuer = S::Issuer; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { - type Issuer = S::Issuer; - type Uri = S::Uri; type Subject = S::Subject; type Handle = Set; - type CreatedAt = S::CreatedAt; + type Uri = S::Uri; type DisplayName = S::DisplayName; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt(PhantomData S>); - impl sealed::Sealed for SetCreatedAt {} - impl State for SetCreatedAt { type Issuer = S::Issuer; - type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { type Subject = S::Subject; type Handle = S::Handle; - type CreatedAt = Set; + type Uri = Set; type DisplayName = S::DisplayName; + type Issuer = S::Issuer; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName(PhantomData S>); impl sealed::Sealed for SetDisplayName {} impl State for SetDisplayName { - type Issuer = S::Issuer; + type Subject = S::Subject; + type Handle = S::Handle; type Uri = S::Uri; + type DisplayName = Set; + type Issuer = S::Issuer; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `issuer` field to Set + pub struct SetIssuer(PhantomData S>); + impl sealed::Sealed for SetIssuer {} + impl State for SetIssuer { type Subject = S::Subject; type Handle = S::Handle; + type Uri = S::Uri; + type DisplayName = S::DisplayName; + type Issuer = Set; type CreatedAt = S::CreatedAt; - type DisplayName = Set; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt(PhantomData S>); + impl sealed::Sealed for SetCreatedAt {} + impl State for SetCreatedAt { + type Subject = S::Subject; + type Handle = S::Handle; + type Uri = S::Uri; + type DisplayName = S::DisplayName; + type Issuer = S::Issuer; + type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `issuer` field - pub struct issuer(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `handle` field pub struct handle(()); - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `display_name` field pub struct display_name(()); + ///Marker type for the `issuer` field + pub struct issuer(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -479,12 +479,12 @@ where impl<'a, S> VerificationViewBuilder<'a, S> where S: verification_view_state::State, - S::Issuer: verification_view_state::IsSet, - S::Uri: verification_view_state::IsSet, S::Subject: verification_view_state::IsSet, S::Handle: verification_view_state::IsSet, - S::CreatedAt: verification_view_state::IsSet, + S::Uri: verification_view_state::IsSet, S::DisplayName: verification_view_state::IsSet, + S::Issuer: verification_view_state::IsSet, + S::CreatedAt: verification_view_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationView<'a> { @@ -579,7 +579,7 @@ fn lexicon_doc_tools_ozone_verification_defs() -> ::jacquard_lexicon::lexicon::L revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("verificationView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -601,7 +601,7 @@ fn lexicon_doc_tools_ozone_verification_defs() -> ::jacquard_lexicon::lexicon::L nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -864,7 +864,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationView<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/verification/grant_verifications.rs b/crates/weaver-api/src/tools_ozone/verification/grant_verifications.rs index e0c8768..e4159ca 100644 --- a/crates/weaver-api/src/tools_ozone/verification/grant_verifications.rs +++ b/crates/weaver-api/src/tools_ozone/verification/grant_verifications.rs @@ -177,7 +177,7 @@ fn lexicon_doc_tools_ozone_verification_grantVerifications() -> ::jacquard_lexic revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("grantError"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { @@ -195,7 +195,7 @@ fn lexicon_doc_tools_ozone_verification_grantVerifications() -> ::jacquard_lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("error"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -261,7 +261,7 @@ fn lexicon_doc_tools_ozone_verification_grantVerifications() -> ::jacquard_lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "verifications", @@ -305,7 +305,7 @@ fn lexicon_doc_tools_ozone_verification_grantVerifications() -> ::jacquard_lexic nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", @@ -413,7 +413,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GrantError<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } @@ -841,7 +841,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationInput<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-api/src/tools_ozone/verification/revoke_verifications.rs b/crates/weaver-api/src/tools_ozone/verification/revoke_verifications.rs index 107233c..4df939a 100644 --- a/crates/weaver-api/src/tools_ozone/verification/revoke_verifications.rs +++ b/crates/weaver-api/src/tools_ozone/verification/revoke_verifications.rs @@ -236,37 +236,37 @@ pub mod revoke_error_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Error; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Error = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri(PhantomData S>); - impl sealed::Sealed for SetUri {} - impl State for SetUri { - type Uri = Set; - type Error = S::Error; + type Uri = Unset; } ///State transition - sets the `error` field to Set pub struct SetError(PhantomData S>); impl sealed::Sealed for SetError {} impl State for SetError { - type Uri = S::Uri; type Error = Set; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri(PhantomData S>); + impl sealed::Sealed for SetUri {} + impl State for SetUri { + type Error = S::Error; + type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `error` field pub struct error(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -339,8 +339,8 @@ where impl<'a, S> RevokeErrorBuilder<'a, S> where S: revoke_error_state::State, - S::Uri: revoke_error_state::IsSet, S::Error: revoke_error_state::IsSet, + S::Uri: revoke_error_state::IsSet, { /// Build the final struct pub fn build(self) -> RevokeError<'a> { @@ -377,7 +377,7 @@ fn lexicon_doc_tools_ozone_verification_revokeVerifications() -> ::jacquard_lexi revision: None, description: None, defs: { - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcProcedure(::jacquard_lexicon::lexicon::LexXrpcProcedure { @@ -399,7 +399,7 @@ fn lexicon_doc_tools_ozone_verification_revokeVerifications() -> ::jacquard_lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "revokeReason", @@ -477,7 +477,7 @@ fn lexicon_doc_tools_ozone_verification_revokeVerifications() -> ::jacquard_lexi nullable: None, properties: { #[allow(unused_mut)] - let mut map = ::std::collections::BTreeMap::new(); + let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("error"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { @@ -539,7 +539,7 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RevokeError<'a> { } fn validate( &self, - ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } \ No newline at end of file diff --git a/crates/weaver-editor-js/.gitignore b/crates/weaver-editor-js/.gitignore index ebf1dde..c9ec670 100644 --- a/crates/weaver-editor-js/.gitignore +++ b/crates/weaver-editor-js/.gitignore @@ -1,2 +1,3 @@ pkg/ target/ +!.cargo/config.toml diff --git a/crates/weaver-index/src/endpoints/edit.rs b/crates/weaver-index/src/endpoints/edit.rs index 6be6503..134a7b5 100644 --- a/crates/weaver-index/src/endpoints/edit.rs +++ b/crates/weaver-index/src/endpoints/edit.rs @@ -11,12 +11,12 @@ use jacquard_axum::ExtractXrpc; use jacquard_axum::service_auth::ExtractOptionalServiceAuth; use weaver_api::com_atproto::repo::strong_ref::StrongRef; -use weaver_api::sh_weaver::edit::EditHistoryEntry; use weaver_api::sh_weaver::edit::get_contributors::{ GetContributorsOutput, GetContributorsRequest, }; use weaver_api::sh_weaver::edit::get_edit_history::{GetEditHistoryOutput, GetEditHistoryRequest}; use weaver_api::sh_weaver::edit::list_drafts::{DraftView, ListDraftsOutput, ListDraftsRequest}; +use weaver_api::sh_weaver::edit::{EditHistoryEntry, EditHistoryEntryType}; use crate::clickhouse::{EditNodeRow, ProfileRow}; use crate::endpoints::actor::{Viewer, resolve_actor}; @@ -192,7 +192,7 @@ fn node_to_history_entry( .cid(cid) .author(author) .created_at(created_at) - .r#type(node.node_type.clone()) + .r#type(EditHistoryEntryType::from(node.node_type.as_str()).into_static()) .maybe_has_inline_diff(Some(node.has_inline_diff == 1)) .maybe_prev_ref(prev_ref) .maybe_root_ref(root_ref) @@ -297,7 +297,8 @@ pub async fn list_drafts( ExtractXrpc(args): ExtractXrpc, ) -> Result>, XrpcErrorResponse> { // Require authentication - let viewer = viewer.ok_or_else(|| XrpcErrorResponse::auth_required("Authentication required"))?; + let viewer = + viewer.ok_or_else(|| XrpcErrorResponse::auth_required("Authentication required"))?; let viewer_did = viewer.did(); let limit = args.limit.unwrap_or(50).min(100).max(1); @@ -316,7 +317,9 @@ pub async fn list_drafts( // Permission check: viewer must be the actor (owner access) // TODO: Add collab grant check for draft sharing if viewer_did.as_str() != actor_did.as_str() { - return Err(XrpcErrorResponse::forbidden("Cannot view another user's drafts")); + return Err(XrpcErrorResponse::forbidden( + "Cannot view another user's drafts", + )); } // Fetch drafts diff --git a/lexicons.kdl b/lexicons.kdl index 69c2fb0..6b14fef 100644 --- a/lexicons.kdl +++ b/lexicons.kdl @@ -11,13 +11,15 @@ output { // } source "weaver" type="local" priority=100 { - //path "./lexicons" path "/home/orual/Projects/weaver.sh/crates/weaver-api/lexicons" - } source "weaver" type="local" priority=200 { path "./lexicons" +} +source "deckbelcher" type="git" priority=100 { + repo "https://tangled.org/aviva.gay/deckbelcher" + pattern "**/*.json" } -- 2.51.2