A better Rust ATProto crate
99
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug fixes, repo by collection function

+460 -306
+30 -30
crates/jacquard-codegen-tests/src/generated/macro_mode/app_bsky/embed/external.rs
··· 233 233 /// State trait tracking which required fields have been set 234 234 pub trait State: sealed::Sealed { 235 235 type Uri; 236 - type Title; 237 236 type Description; 237 + type Title; 238 238 } 239 239 /// Empty state - all required fields are unset 240 240 pub struct Empty(()); 241 241 impl sealed::Sealed for Empty {} 242 242 impl State for Empty { 243 243 type Uri = Unset; 244 - type Title = Unset; 245 244 type Description = Unset; 245 + type Title = Unset; 246 246 } 247 247 ///State transition - sets the `uri` field to Set 248 248 pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 249 249 impl<St: State> sealed::Sealed for SetUri<St> {} 250 250 impl<St: State> State for SetUri<St> { 251 251 type Uri = Set<members::uri>; 252 - type Title = St::Title; 253 252 type Description = St::Description; 254 - } 255 - ///State transition - sets the `title` field to Set 256 - pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>); 257 - impl<St: State> sealed::Sealed for SetTitle<St> {} 258 - impl<St: State> State for SetTitle<St> { 259 - type Uri = St::Uri; 260 - type Title = Set<members::title>; 261 - type Description = St::Description; 253 + type Title = St::Title; 262 254 } 263 255 ///State transition - sets the `description` field to Set 264 256 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 265 257 impl<St: State> sealed::Sealed for SetDescription<St> {} 266 258 impl<St: State> State for SetDescription<St> { 267 259 type Uri = St::Uri; 268 - type Title = St::Title; 269 260 type Description = Set<members::description>; 261 + type Title = St::Title; 262 + } 263 + ///State transition - sets the `title` field to Set 264 + pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>); 265 + impl<St: State> sealed::Sealed for SetTitle<St> {} 266 + impl<St: State> State for SetTitle<St> { 267 + type Uri = St::Uri; 268 + type Description = St::Description; 269 + type Title = Set<members::title>; 270 270 } 271 271 /// Marker types for field names 272 272 #[allow(non_camel_case_types)] 273 273 pub mod members { 274 274 ///Marker type for the `uri` field 275 275 pub struct uri(()); 276 + ///Marker type for the `description` field 277 + pub struct description(()); 276 278 ///Marker type for the `title` field 277 279 pub struct title(()); 278 - ///Marker type for the `description` field 279 - pub struct description(()); 280 280 } 281 281 } 282 282 ··· 390 390 where 391 391 St: external_state::State, 392 392 St::Uri: external_state::IsSet, 393 - St::Title: external_state::IsSet, 394 393 St::Description: external_state::IsSet, 394 + St::Title: external_state::IsSet, 395 395 { 396 396 /// Build the final struct. 397 397 pub fn build(self) -> External<S> { ··· 827 827 /// State trait tracking which required fields have been set 828 828 pub trait State: sealed::Sealed { 829 829 type Title; 830 - type Uri; 831 830 type Description; 831 + type Uri; 832 832 } 833 833 /// Empty state - all required fields are unset 834 834 pub struct Empty(()); 835 835 impl sealed::Sealed for Empty {} 836 836 impl State for Empty { 837 837 type Title = Unset; 838 - type Uri = Unset; 839 838 type Description = Unset; 839 + type Uri = Unset; 840 840 } 841 841 ///State transition - sets the `title` field to Set 842 842 pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>); 843 843 impl<St: State> sealed::Sealed for SetTitle<St> {} 844 844 impl<St: State> State for SetTitle<St> { 845 845 type Title = Set<members::title>; 846 - type Uri = St::Uri; 847 846 type Description = St::Description; 848 - } 849 - ///State transition - sets the `uri` field to Set 850 - pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 851 - impl<St: State> sealed::Sealed for SetUri<St> {} 852 - impl<St: State> State for SetUri<St> { 853 - type Title = St::Title; 854 - type Uri = Set<members::uri>; 855 - type Description = St::Description; 847 + type Uri = St::Uri; 856 848 } 857 849 ///State transition - sets the `description` field to Set 858 850 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 859 851 impl<St: State> sealed::Sealed for SetDescription<St> {} 860 852 impl<St: State> State for SetDescription<St> { 861 853 type Title = St::Title; 862 - type Uri = St::Uri; 863 854 type Description = Set<members::description>; 855 + type Uri = St::Uri; 856 + } 857 + ///State transition - sets the `uri` field to Set 858 + pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 859 + impl<St: State> sealed::Sealed for SetUri<St> {} 860 + impl<St: State> State for SetUri<St> { 861 + type Title = St::Title; 862 + type Description = St::Description; 863 + type Uri = Set<members::uri>; 864 864 } 865 865 /// Marker types for field names 866 866 #[allow(non_camel_case_types)] 867 867 pub mod members { 868 868 ///Marker type for the `title` field 869 869 pub struct title(()); 870 + ///Marker type for the `description` field 871 + pub struct description(()); 870 872 ///Marker type for the `uri` field 871 873 pub struct uri(()); 872 - ///Marker type for the `description` field 873 - pub struct description(()); 874 874 } 875 875 } 876 876 ··· 990 990 where 991 991 St: view_external_state::State, 992 992 St::Title: view_external_state::IsSet, 993 - St::Uri: view_external_state::IsSet, 994 993 St::Description: view_external_state::IsSet, 994 + St::Uri: view_external_state::IsSet, 995 995 { 996 996 /// Build the final struct. 997 997 pub fn build(self) -> ViewExternal<S> {
+26 -26
crates/jacquard-codegen-tests/src/generated/macro_mode/app_bsky/richtext/facet.rs
··· 310 310 } 311 311 /// State trait tracking which required fields have been set 312 312 pub trait State: sealed::Sealed { 313 - type ByteEnd; 314 313 type ByteStart; 314 + type ByteEnd; 315 315 } 316 316 /// Empty state - all required fields are unset 317 317 pub struct Empty(()); 318 318 impl sealed::Sealed for Empty {} 319 319 impl State for Empty { 320 - type ByteEnd = Unset; 321 320 type ByteStart = Unset; 322 - } 323 - ///State transition - sets the `byte_end` field to Set 324 - pub struct SetByteEnd<St: State = Empty>(PhantomData<fn() -> St>); 325 - impl<St: State> sealed::Sealed for SetByteEnd<St> {} 326 - impl<St: State> State for SetByteEnd<St> { 327 - type ByteEnd = Set<members::byte_end>; 328 - type ByteStart = St::ByteStart; 321 + type ByteEnd = Unset; 329 322 } 330 323 ///State transition - sets the `byte_start` field to Set 331 324 pub struct SetByteStart<St: State = Empty>(PhantomData<fn() -> St>); 332 325 impl<St: State> sealed::Sealed for SetByteStart<St> {} 333 326 impl<St: State> State for SetByteStart<St> { 334 - type ByteEnd = St::ByteEnd; 335 327 type ByteStart = Set<members::byte_start>; 328 + type ByteEnd = St::ByteEnd; 329 + } 330 + ///State transition - sets the `byte_end` field to Set 331 + pub struct SetByteEnd<St: State = Empty>(PhantomData<fn() -> St>); 332 + impl<St: State> sealed::Sealed for SetByteEnd<St> {} 333 + impl<St: State> State for SetByteEnd<St> { 334 + type ByteStart = St::ByteStart; 335 + type ByteEnd = Set<members::byte_end>; 336 336 } 337 337 /// Marker types for field names 338 338 #[allow(non_camel_case_types)] 339 339 pub mod members { 340 - ///Marker type for the `byte_end` field 341 - pub struct byte_end(()); 342 340 ///Marker type for the `byte_start` field 343 341 pub struct byte_start(()); 342 + ///Marker type for the `byte_end` field 343 + pub struct byte_end(()); 344 344 } 345 345 } 346 346 ··· 410 410 impl<S: jacquard_common::BosStr, St> ByteSliceBuilder<S, St> 411 411 where 412 412 St: byte_slice_state::State, 413 - St::ByteEnd: byte_slice_state::IsSet, 414 413 St::ByteStart: byte_slice_state::IsSet, 414 + St::ByteEnd: byte_slice_state::IsSet, 415 415 { 416 416 /// Build the final struct. 417 417 pub fn build(self) -> ByteSlice<S> { ··· 746 746 } 747 747 /// State trait tracking which required fields have been set 748 748 pub trait State: sealed::Sealed { 749 - type Features; 750 749 type Index; 750 + type Features; 751 751 } 752 752 /// Empty state - all required fields are unset 753 753 pub struct Empty(()); 754 754 impl sealed::Sealed for Empty {} 755 755 impl State for Empty { 756 - type Features = Unset; 757 756 type Index = Unset; 758 - } 759 - ///State transition - sets the `features` field to Set 760 - pub struct SetFeatures<St: State = Empty>(PhantomData<fn() -> St>); 761 - impl<St: State> sealed::Sealed for SetFeatures<St> {} 762 - impl<St: State> State for SetFeatures<St> { 763 - type Features = Set<members::features>; 764 - type Index = St::Index; 757 + type Features = Unset; 765 758 } 766 759 ///State transition - sets the `index` field to Set 767 760 pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>); 768 761 impl<St: State> sealed::Sealed for SetIndex<St> {} 769 762 impl<St: State> State for SetIndex<St> { 770 - type Features = St::Features; 771 763 type Index = Set<members::index>; 764 + type Features = St::Features; 765 + } 766 + ///State transition - sets the `features` field to Set 767 + pub struct SetFeatures<St: State = Empty>(PhantomData<fn() -> St>); 768 + impl<St: State> sealed::Sealed for SetFeatures<St> {} 769 + impl<St: State> State for SetFeatures<St> { 770 + type Index = St::Index; 771 + type Features = Set<members::features>; 772 772 } 773 773 /// Marker types for field names 774 774 #[allow(non_camel_case_types)] 775 775 pub mod members { 776 - ///Marker type for the `features` field 777 - pub struct features(()); 778 776 ///Marker type for the `index` field 779 777 pub struct index(()); 778 + ///Marker type for the `features` field 779 + pub struct features(()); 780 780 } 781 781 } 782 782 ··· 849 849 impl<S: jacquard_common::BosStr, St> FacetBuilder<S, St> 850 850 where 851 851 St: facet_state::State, 852 - St::Features: facet_state::IsSet, 853 852 St::Index: facet_state::IsSet, 853 + St::Features: facet_state::IsSet, 854 854 { 855 855 /// Build the final struct. 856 856 pub fn build(self) -> Facet<S> {
+64 -64
crates/jacquard-codegen-tests/src/generated/macro_mode/com_atproto/label.rs
··· 797 797 } 798 798 /// State trait tracking which required fields have been set 799 799 pub trait State: sealed::Sealed { 800 + type Val; 800 801 type Cts; 801 802 type Uri; 802 803 type Src; 803 - type Val; 804 804 } 805 805 /// Empty state - all required fields are unset 806 806 pub struct Empty(()); 807 807 impl sealed::Sealed for Empty {} 808 808 impl State for Empty { 809 + type Val = Unset; 809 810 type Cts = Unset; 810 811 type Uri = Unset; 811 812 type Src = Unset; 812 - type Val = Unset; 813 + } 814 + ///State transition - sets the `val` field to Set 815 + pub struct SetVal<St: State = Empty>(PhantomData<fn() -> St>); 816 + impl<St: State> sealed::Sealed for SetVal<St> {} 817 + impl<St: State> State for SetVal<St> { 818 + type Val = Set<members::val>; 819 + type Cts = St::Cts; 820 + type Uri = St::Uri; 821 + type Src = St::Src; 813 822 } 814 823 ///State transition - sets the `cts` field to Set 815 824 pub struct SetCts<St: State = Empty>(PhantomData<fn() -> St>); 816 825 impl<St: State> sealed::Sealed for SetCts<St> {} 817 826 impl<St: State> State for SetCts<St> { 827 + type Val = St::Val; 818 828 type Cts = Set<members::cts>; 819 829 type Uri = St::Uri; 820 830 type Src = St::Src; 821 - type Val = St::Val; 822 831 } 823 832 ///State transition - sets the `uri` field to Set 824 833 pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 825 834 impl<St: State> sealed::Sealed for SetUri<St> {} 826 835 impl<St: State> State for SetUri<St> { 836 + type Val = St::Val; 827 837 type Cts = St::Cts; 828 838 type Uri = Set<members::uri>; 829 839 type Src = St::Src; 830 - type Val = St::Val; 831 840 } 832 841 ///State transition - sets the `src` field to Set 833 842 pub struct SetSrc<St: State = Empty>(PhantomData<fn() -> St>); 834 843 impl<St: State> sealed::Sealed for SetSrc<St> {} 835 844 impl<St: State> State for SetSrc<St> { 836 - type Cts = St::Cts; 837 - type Uri = St::Uri; 838 - type Src = Set<members::src>; 839 845 type Val = St::Val; 840 - } 841 - ///State transition - sets the `val` field to Set 842 - pub struct SetVal<St: State = Empty>(PhantomData<fn() -> St>); 843 - impl<St: State> sealed::Sealed for SetVal<St> {} 844 - impl<St: State> State for SetVal<St> { 845 846 type Cts = St::Cts; 846 847 type Uri = St::Uri; 847 - type Src = St::Src; 848 - type Val = Set<members::val>; 848 + type Src = Set<members::src>; 849 849 } 850 850 /// Marker types for field names 851 851 #[allow(non_camel_case_types)] 852 852 pub mod members { 853 + ///Marker type for the `val` field 854 + pub struct val(()); 853 855 ///Marker type for the `cts` field 854 856 pub struct cts(()); 855 857 ///Marker type for the `uri` field 856 858 pub struct uri(()); 857 859 ///Marker type for the `src` field 858 860 pub struct src(()); 859 - ///Marker type for the `val` field 860 - pub struct val(()); 861 861 } 862 862 } 863 863 ··· 1058 1058 impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 1059 1059 where 1060 1060 St: label_state::State, 1061 + St::Val: label_state::IsSet, 1061 1062 St::Cts: label_state::IsSet, 1062 1063 St::Uri: label_state::IsSet, 1063 1064 St::Src: label_state::IsSet, 1064 - St::Val: label_state::IsSet, 1065 1065 { 1066 1066 /// Build the final struct. 1067 1067 pub fn build(self) -> Label<S> { ··· 1515 1515 } 1516 1516 /// State trait tracking which required fields have been set 1517 1517 pub trait State: sealed::Sealed { 1518 + type Identifier; 1519 + type Blurs; 1518 1520 type Locales; 1519 1521 type Severity; 1520 - type Blurs; 1521 - type Identifier; 1522 1522 } 1523 1523 /// Empty state - all required fields are unset 1524 1524 pub struct Empty(()); 1525 1525 impl sealed::Sealed for Empty {} 1526 1526 impl State for Empty { 1527 + type Identifier = Unset; 1528 + type Blurs = Unset; 1527 1529 type Locales = Unset; 1528 1530 type Severity = Unset; 1529 - type Blurs = Unset; 1530 - type Identifier = Unset; 1531 + } 1532 + ///State transition - sets the `identifier` field to Set 1533 + pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>); 1534 + impl<St: State> sealed::Sealed for SetIdentifier<St> {} 1535 + impl<St: State> State for SetIdentifier<St> { 1536 + type Identifier = Set<members::identifier>; 1537 + type Blurs = St::Blurs; 1538 + type Locales = St::Locales; 1539 + type Severity = St::Severity; 1540 + } 1541 + ///State transition - sets the `blurs` field to Set 1542 + pub struct SetBlurs<St: State = Empty>(PhantomData<fn() -> St>); 1543 + impl<St: State> sealed::Sealed for SetBlurs<St> {} 1544 + impl<St: State> State for SetBlurs<St> { 1545 + type Identifier = St::Identifier; 1546 + type Blurs = Set<members::blurs>; 1547 + type Locales = St::Locales; 1548 + type Severity = St::Severity; 1531 1549 } 1532 1550 ///State transition - sets the `locales` field to Set 1533 1551 pub struct SetLocales<St: State = Empty>(PhantomData<fn() -> St>); 1534 1552 impl<St: State> sealed::Sealed for SetLocales<St> {} 1535 1553 impl<St: State> State for SetLocales<St> { 1554 + type Identifier = St::Identifier; 1555 + type Blurs = St::Blurs; 1536 1556 type Locales = Set<members::locales>; 1537 1557 type Severity = St::Severity; 1538 - type Blurs = St::Blurs; 1539 - type Identifier = St::Identifier; 1540 1558 } 1541 1559 ///State transition - sets the `severity` field to Set 1542 1560 pub struct SetSeverity<St: State = Empty>(PhantomData<fn() -> St>); 1543 1561 impl<St: State> sealed::Sealed for SetSeverity<St> {} 1544 1562 impl<St: State> State for SetSeverity<St> { 1545 - type Locales = St::Locales; 1546 - type Severity = Set<members::severity>; 1547 - type Blurs = St::Blurs; 1548 1563 type Identifier = St::Identifier; 1549 - } 1550 - ///State transition - sets the `blurs` field to Set 1551 - pub struct SetBlurs<St: State = Empty>(PhantomData<fn() -> St>); 1552 - impl<St: State> sealed::Sealed for SetBlurs<St> {} 1553 - impl<St: State> State for SetBlurs<St> { 1554 - type Locales = St::Locales; 1555 - type Severity = St::Severity; 1556 - type Blurs = Set<members::blurs>; 1557 - type Identifier = St::Identifier; 1558 - } 1559 - ///State transition - sets the `identifier` field to Set 1560 - pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>); 1561 - impl<St: State> sealed::Sealed for SetIdentifier<St> {} 1562 - impl<St: State> State for SetIdentifier<St> { 1563 - type Locales = St::Locales; 1564 - type Severity = St::Severity; 1565 1564 type Blurs = St::Blurs; 1566 - type Identifier = Set<members::identifier>; 1565 + type Locales = St::Locales; 1566 + type Severity = Set<members::severity>; 1567 1567 } 1568 1568 /// Marker types for field names 1569 1569 #[allow(non_camel_case_types)] 1570 1570 pub mod members { 1571 + ///Marker type for the `identifier` field 1572 + pub struct identifier(()); 1573 + ///Marker type for the `blurs` field 1574 + pub struct blurs(()); 1571 1575 ///Marker type for the `locales` field 1572 1576 pub struct locales(()); 1573 1577 ///Marker type for the `severity` field 1574 1578 pub struct severity(()); 1575 - ///Marker type for the `blurs` field 1576 - pub struct blurs(()); 1577 - ///Marker type for the `identifier` field 1578 - pub struct identifier(()); 1579 1579 } 1580 1580 } 1581 1581 ··· 1740 1740 impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1741 1741 where 1742 1742 St: label_value_definition_state::State, 1743 + St::Identifier: label_value_definition_state::IsSet, 1744 + St::Blurs: label_value_definition_state::IsSet, 1743 1745 St::Locales: label_value_definition_state::IsSet, 1744 1746 St::Severity: label_value_definition_state::IsSet, 1745 - St::Blurs: label_value_definition_state::IsSet, 1746 - St::Identifier: label_value_definition_state::IsSet, 1747 1747 { 1748 1748 /// Build the final struct. 1749 1749 pub fn build(self) -> LabelValueDefinition<S> { ··· 1787 1787 } 1788 1788 /// State trait tracking which required fields have been set 1789 1789 pub trait State: sealed::Sealed { 1790 - type Lang; 1791 1790 type Name; 1791 + type Lang; 1792 1792 type Description; 1793 1793 } 1794 1794 /// Empty state - all required fields are unset 1795 1795 pub struct Empty(()); 1796 1796 impl sealed::Sealed for Empty {} 1797 1797 impl State for Empty { 1798 - type Lang = Unset; 1799 1798 type Name = Unset; 1799 + type Lang = Unset; 1800 1800 type Description = Unset; 1801 1801 } 1802 - ///State transition - sets the `lang` field to Set 1803 - pub struct SetLang<St: State = Empty>(PhantomData<fn() -> St>); 1804 - impl<St: State> sealed::Sealed for SetLang<St> {} 1805 - impl<St: State> State for SetLang<St> { 1806 - type Lang = Set<members::lang>; 1807 - type Name = St::Name; 1808 - type Description = St::Description; 1809 - } 1810 1802 ///State transition - sets the `name` field to Set 1811 1803 pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>); 1812 1804 impl<St: State> sealed::Sealed for SetName<St> {} 1813 1805 impl<St: State> State for SetName<St> { 1814 - type Lang = St::Lang; 1815 1806 type Name = Set<members::name>; 1807 + type Lang = St::Lang; 1808 + type Description = St::Description; 1809 + } 1810 + ///State transition - sets the `lang` field to Set 1811 + pub struct SetLang<St: State = Empty>(PhantomData<fn() -> St>); 1812 + impl<St: State> sealed::Sealed for SetLang<St> {} 1813 + impl<St: State> State for SetLang<St> { 1814 + type Name = St::Name; 1815 + type Lang = Set<members::lang>; 1816 1816 type Description = St::Description; 1817 1817 } 1818 1818 ///State transition - sets the `description` field to Set 1819 1819 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 1820 1820 impl<St: State> sealed::Sealed for SetDescription<St> {} 1821 1821 impl<St: State> State for SetDescription<St> { 1822 - type Lang = St::Lang; 1823 1822 type Name = St::Name; 1823 + type Lang = St::Lang; 1824 1824 type Description = Set<members::description>; 1825 1825 } 1826 1826 /// Marker types for field names 1827 1827 #[allow(non_camel_case_types)] 1828 1828 pub mod members { 1829 + ///Marker type for the `name` field 1830 + pub struct name(()); 1829 1831 ///Marker type for the `lang` field 1830 1832 pub struct lang(()); 1831 - ///Marker type for the `name` field 1832 - pub struct name(()); 1833 1833 ///Marker type for the `description` field 1834 1834 pub struct description(()); 1835 1835 } ··· 1941 1941 impl<S: jacquard_common::BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1942 1942 where 1943 1943 St: label_value_definition_strings_state::State, 1944 - St::Lang: label_value_definition_strings_state::IsSet, 1945 1944 St::Name: label_value_definition_strings_state::IsSet, 1945 + St::Lang: label_value_definition_strings_state::IsSet, 1946 1946 St::Description: label_value_definition_strings_state::IsSet, 1947 1947 { 1948 1948 /// Build the final struct.
+13 -13
crates/jacquard-codegen-tests/src/generated/macro_mode/test_ns3/collision.rs
··· 335 335 } 336 336 /// State trait tracking which required fields have been set 337 337 pub trait State: sealed::Sealed { 338 - type LocalFoo; 339 338 type ExternalFoo; 339 + type LocalFoo; 340 340 } 341 341 /// Empty state - all required fields are unset 342 342 pub struct Empty(()); 343 343 impl sealed::Sealed for Empty {} 344 344 impl State for Empty { 345 - type LocalFoo = Unset; 346 345 type ExternalFoo = Unset; 347 - } 348 - ///State transition - sets the `local_foo` field to Set 349 - pub struct SetLocalFoo<St: State = Empty>(PhantomData<fn() -> St>); 350 - impl<St: State> sealed::Sealed for SetLocalFoo<St> {} 351 - impl<St: State> State for SetLocalFoo<St> { 352 - type LocalFoo = Set<members::local_foo>; 353 - type ExternalFoo = St::ExternalFoo; 346 + type LocalFoo = Unset; 354 347 } 355 348 ///State transition - sets the `external_foo` field to Set 356 349 pub struct SetExternalFoo<St: State = Empty>(PhantomData<fn() -> St>); 357 350 impl<St: State> sealed::Sealed for SetExternalFoo<St> {} 358 351 impl<St: State> State for SetExternalFoo<St> { 359 - type LocalFoo = St::LocalFoo; 360 352 type ExternalFoo = Set<members::external_foo>; 353 + type LocalFoo = St::LocalFoo; 354 + } 355 + ///State transition - sets the `local_foo` field to Set 356 + pub struct SetLocalFoo<St: State = Empty>(PhantomData<fn() -> St>); 357 + impl<St: State> sealed::Sealed for SetLocalFoo<St> {} 358 + impl<St: State> State for SetLocalFoo<St> { 359 + type ExternalFoo = St::ExternalFoo; 360 + type LocalFoo = Set<members::local_foo>; 361 361 } 362 362 /// Marker types for field names 363 363 #[allow(non_camel_case_types)] 364 364 pub mod members { 365 - ///Marker type for the `local_foo` field 366 - pub struct local_foo(()); 367 365 ///Marker type for the `external_foo` field 368 366 pub struct external_foo(()); 367 + ///Marker type for the `local_foo` field 368 + pub struct local_foo(()); 369 369 } 370 370 } 371 371 ··· 452 452 impl<S: jacquard_common::BosStr, St> CollisionBuilder<S, St> 453 453 where 454 454 St: collision_state::State, 455 - St::LocalFoo: collision_state::IsSet, 456 455 St::ExternalFoo: collision_state::IsSet, 456 + St::LocalFoo: collision_state::IsSet, 457 457 { 458 458 /// Build the final struct. 459 459 pub fn build(self) -> Collision<S> {
+30 -30
crates/jacquard-codegen-tests/src/generated/pretty/app_bsky/embed/external.rs
··· 179 179 } 180 180 /// State trait tracking which required fields have been set 181 181 pub trait State: sealed::Sealed { 182 + type Uri; 182 183 type Title; 183 184 type Description; 184 - type Uri; 185 185 } 186 186 /// Empty state - all required fields are unset 187 187 pub struct Empty(()); 188 188 impl sealed::Sealed for Empty {} 189 189 impl State for Empty { 190 + type Uri = Unset; 190 191 type Title = Unset; 191 192 type Description = Unset; 192 - type Uri = Unset; 193 + } 194 + ///State transition - sets the `uri` field to Set 195 + pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 196 + impl<St: State> sealed::Sealed for SetUri<St> {} 197 + impl<St: State> State for SetUri<St> { 198 + type Uri = Set<members::uri>; 199 + type Title = St::Title; 200 + type Description = St::Description; 193 201 } 194 202 ///State transition - sets the `title` field to Set 195 203 pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>); 196 204 impl<St: State> sealed::Sealed for SetTitle<St> {} 197 205 impl<St: State> State for SetTitle<St> { 206 + type Uri = St::Uri; 198 207 type Title = Set<members::title>; 199 208 type Description = St::Description; 200 - type Uri = St::Uri; 201 209 } 202 210 ///State transition - sets the `description` field to Set 203 211 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 204 212 impl<St: State> sealed::Sealed for SetDescription<St> {} 205 213 impl<St: State> State for SetDescription<St> { 206 - type Title = St::Title; 207 - type Description = Set<members::description>; 208 214 type Uri = St::Uri; 209 - } 210 - ///State transition - sets the `uri` field to Set 211 - pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 212 - impl<St: State> sealed::Sealed for SetUri<St> {} 213 - impl<St: State> State for SetUri<St> { 214 215 type Title = St::Title; 215 - type Description = St::Description; 216 - type Uri = Set<members::uri>; 216 + type Description = Set<members::description>; 217 217 } 218 218 /// Marker types for field names 219 219 #[allow(non_camel_case_types)] 220 220 pub mod members { 221 + ///Marker type for the `uri` field 222 + pub struct uri(()); 221 223 ///Marker type for the `title` field 222 224 pub struct title(()); 223 225 ///Marker type for the `description` field 224 226 pub struct description(()); 225 - ///Marker type for the `uri` field 226 - pub struct uri(()); 227 227 } 228 228 } 229 229 ··· 325 325 impl<S: BosStr, St> ExternalBuilder<S, St> 326 326 where 327 327 St: external_state::State, 328 + St::Uri: external_state::IsSet, 328 329 St::Title: external_state::IsSet, 329 330 St::Description: external_state::IsSet, 330 - St::Uri: external_state::IsSet, 331 331 { 332 332 /// Build the final struct. 333 333 pub fn build(self) -> External<S> { ··· 692 692 } 693 693 /// State trait tracking which required fields have been set 694 694 pub trait State: sealed::Sealed { 695 - type Uri; 696 695 type Title; 697 696 type Description; 697 + type Uri; 698 698 } 699 699 /// Empty state - all required fields are unset 700 700 pub struct Empty(()); 701 701 impl sealed::Sealed for Empty {} 702 702 impl State for Empty { 703 - type Uri = Unset; 704 703 type Title = Unset; 705 704 type Description = Unset; 706 - } 707 - ///State transition - sets the `uri` field to Set 708 - pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 709 - impl<St: State> sealed::Sealed for SetUri<St> {} 710 - impl<St: State> State for SetUri<St> { 711 - type Uri = Set<members::uri>; 712 - type Title = St::Title; 713 - type Description = St::Description; 705 + type Uri = Unset; 714 706 } 715 707 ///State transition - sets the `title` field to Set 716 708 pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>); 717 709 impl<St: State> sealed::Sealed for SetTitle<St> {} 718 710 impl<St: State> State for SetTitle<St> { 719 - type Uri = St::Uri; 720 711 type Title = Set<members::title>; 721 712 type Description = St::Description; 713 + type Uri = St::Uri; 722 714 } 723 715 ///State transition - sets the `description` field to Set 724 716 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 725 717 impl<St: State> sealed::Sealed for SetDescription<St> {} 726 718 impl<St: State> State for SetDescription<St> { 727 - type Uri = St::Uri; 728 719 type Title = St::Title; 729 720 type Description = Set<members::description>; 721 + type Uri = St::Uri; 722 + } 723 + ///State transition - sets the `uri` field to Set 724 + pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 725 + impl<St: State> sealed::Sealed for SetUri<St> {} 726 + impl<St: State> State for SetUri<St> { 727 + type Title = St::Title; 728 + type Description = St::Description; 729 + type Uri = Set<members::uri>; 730 730 } 731 731 /// Marker types for field names 732 732 #[allow(non_camel_case_types)] 733 733 pub mod members { 734 - ///Marker type for the `uri` field 735 - pub struct uri(()); 736 734 ///Marker type for the `title` field 737 735 pub struct title(()); 738 736 ///Marker type for the `description` field 739 737 pub struct description(()); 738 + ///Marker type for the `uri` field 739 + pub struct uri(()); 740 740 } 741 741 } 742 742 ··· 838 838 impl<S: BosStr, St> ViewExternalBuilder<S, St> 839 839 where 840 840 St: view_external_state::State, 841 - St::Uri: view_external_state::IsSet, 842 841 St::Title: view_external_state::IsSet, 843 842 St::Description: view_external_state::IsSet, 843 + St::Uri: view_external_state::IsSet, 844 844 { 845 845 /// Build the final struct. 846 846 pub fn build(self) -> ViewExternal<S> {
+13 -13
crates/jacquard-codegen-tests/src/generated/pretty/app_bsky/richtext/facet.rs
··· 616 616 } 617 617 /// State trait tracking which required fields have been set 618 618 pub trait State: sealed::Sealed { 619 - type Index; 620 619 type Features; 620 + type Index; 621 621 } 622 622 /// Empty state - all required fields are unset 623 623 pub struct Empty(()); 624 624 impl sealed::Sealed for Empty {} 625 625 impl State for Empty { 626 - type Index = Unset; 627 626 type Features = Unset; 628 - } 629 - ///State transition - sets the `index` field to Set 630 - pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>); 631 - impl<St: State> sealed::Sealed for SetIndex<St> {} 632 - impl<St: State> State for SetIndex<St> { 633 - type Index = Set<members::index>; 634 - type Features = St::Features; 627 + type Index = Unset; 635 628 } 636 629 ///State transition - sets the `features` field to Set 637 630 pub struct SetFeatures<St: State = Empty>(PhantomData<fn() -> St>); 638 631 impl<St: State> sealed::Sealed for SetFeatures<St> {} 639 632 impl<St: State> State for SetFeatures<St> { 640 - type Index = St::Index; 641 633 type Features = Set<members::features>; 634 + type Index = St::Index; 635 + } 636 + ///State transition - sets the `index` field to Set 637 + pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>); 638 + impl<St: State> sealed::Sealed for SetIndex<St> {} 639 + impl<St: State> State for SetIndex<St> { 640 + type Features = St::Features; 641 + type Index = Set<members::index>; 642 642 } 643 643 /// Marker types for field names 644 644 #[allow(non_camel_case_types)] 645 645 pub mod members { 646 - ///Marker type for the `index` field 647 - pub struct index(()); 648 646 ///Marker type for the `features` field 649 647 pub struct features(()); 648 + ///Marker type for the `index` field 649 + pub struct index(()); 650 650 } 651 651 } 652 652 ··· 716 716 impl<S: BosStr, St> FacetBuilder<S, St> 717 717 where 718 718 St: facet_state::State, 719 - St::Index: facet_state::IsSet, 720 719 St::Features: facet_state::IsSet, 720 + St::Index: facet_state::IsSet, 721 721 { 722 722 /// Build the final struct. 723 723 pub fn build(self) -> Facet<S> {
+76 -76
crates/jacquard-codegen-tests/src/generated/pretty/com_atproto/label.rs
··· 680 680 /// State trait tracking which required fields have been set 681 681 pub trait State: sealed::Sealed { 682 682 type Src; 683 - type Cts; 684 - type Uri; 685 683 type Val; 684 + type Uri; 685 + type Cts; 686 686 } 687 687 /// Empty state - all required fields are unset 688 688 pub struct Empty(()); 689 689 impl sealed::Sealed for Empty {} 690 690 impl State for Empty { 691 691 type Src = Unset; 692 - type Cts = Unset; 693 - type Uri = Unset; 694 692 type Val = Unset; 693 + type Uri = Unset; 694 + type Cts = Unset; 695 695 } 696 696 ///State transition - sets the `src` field to Set 697 697 pub struct SetSrc<St: State = Empty>(PhantomData<fn() -> St>); 698 698 impl<St: State> sealed::Sealed for SetSrc<St> {} 699 699 impl<St: State> State for SetSrc<St> { 700 700 type Src = Set<members::src>; 701 - type Cts = St::Cts; 702 - type Uri = St::Uri; 703 701 type Val = St::Val; 702 + type Uri = St::Uri; 703 + type Cts = St::Cts; 704 704 } 705 - ///State transition - sets the `cts` field to Set 706 - pub struct SetCts<St: State = Empty>(PhantomData<fn() -> St>); 707 - impl<St: State> sealed::Sealed for SetCts<St> {} 708 - impl<St: State> State for SetCts<St> { 705 + ///State transition - sets the `val` field to Set 706 + pub struct SetVal<St: State = Empty>(PhantomData<fn() -> St>); 707 + impl<St: State> sealed::Sealed for SetVal<St> {} 708 + impl<St: State> State for SetVal<St> { 709 709 type Src = St::Src; 710 - type Cts = Set<members::cts>; 710 + type Val = Set<members::val>; 711 711 type Uri = St::Uri; 712 - type Val = St::Val; 712 + type Cts = St::Cts; 713 713 } 714 714 ///State transition - sets the `uri` field to Set 715 715 pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 716 716 impl<St: State> sealed::Sealed for SetUri<St> {} 717 717 impl<St: State> State for SetUri<St> { 718 718 type Src = St::Src; 719 - type Cts = St::Cts; 719 + type Val = St::Val; 720 720 type Uri = Set<members::uri>; 721 - type Val = St::Val; 721 + type Cts = St::Cts; 722 722 } 723 - ///State transition - sets the `val` field to Set 724 - pub struct SetVal<St: State = Empty>(PhantomData<fn() -> St>); 725 - impl<St: State> sealed::Sealed for SetVal<St> {} 726 - impl<St: State> State for SetVal<St> { 723 + ///State transition - sets the `cts` field to Set 724 + pub struct SetCts<St: State = Empty>(PhantomData<fn() -> St>); 725 + impl<St: State> sealed::Sealed for SetCts<St> {} 726 + impl<St: State> State for SetCts<St> { 727 727 type Src = St::Src; 728 - type Cts = St::Cts; 728 + type Val = St::Val; 729 729 type Uri = St::Uri; 730 - type Val = Set<members::val>; 730 + type Cts = Set<members::cts>; 731 731 } 732 732 /// Marker types for field names 733 733 #[allow(non_camel_case_types)] 734 734 pub mod members { 735 735 ///Marker type for the `src` field 736 736 pub struct src(()); 737 - ///Marker type for the `cts` field 738 - pub struct cts(()); 739 - ///Marker type for the `uri` field 740 - pub struct uri(()); 741 737 ///Marker type for the `val` field 742 738 pub struct val(()); 739 + ///Marker type for the `uri` field 740 + pub struct uri(()); 741 + ///Marker type for the `cts` field 742 + pub struct cts(()); 743 743 } 744 744 } 745 745 ··· 923 923 where 924 924 St: label_state::State, 925 925 St::Src: label_state::IsSet, 926 - St::Cts: label_state::IsSet, 927 - St::Uri: label_state::IsSet, 928 926 St::Val: label_state::IsSet, 927 + St::Uri: label_state::IsSet, 928 + St::Cts: label_state::IsSet, 929 929 { 930 930 /// Build the final struct. 931 931 pub fn build(self) -> Label<S> { ··· 1297 1297 } 1298 1298 /// State trait tracking which required fields have been set 1299 1299 pub trait State: sealed::Sealed { 1300 - type Identifier; 1300 + type Blurs; 1301 1301 type Locales; 1302 1302 type Severity; 1303 - type Blurs; 1303 + type Identifier; 1304 1304 } 1305 1305 /// Empty state - all required fields are unset 1306 1306 pub struct Empty(()); 1307 1307 impl sealed::Sealed for Empty {} 1308 1308 impl State for Empty { 1309 - type Identifier = Unset; 1309 + type Blurs = Unset; 1310 1310 type Locales = Unset; 1311 1311 type Severity = Unset; 1312 - type Blurs = Unset; 1312 + type Identifier = Unset; 1313 1313 } 1314 - ///State transition - sets the `identifier` field to Set 1315 - pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>); 1316 - impl<St: State> sealed::Sealed for SetIdentifier<St> {} 1317 - impl<St: State> State for SetIdentifier<St> { 1318 - type Identifier = Set<members::identifier>; 1314 + ///State transition - sets the `blurs` field to Set 1315 + pub struct SetBlurs<St: State = Empty>(PhantomData<fn() -> St>); 1316 + impl<St: State> sealed::Sealed for SetBlurs<St> {} 1317 + impl<St: State> State for SetBlurs<St> { 1318 + type Blurs = Set<members::blurs>; 1319 1319 type Locales = St::Locales; 1320 1320 type Severity = St::Severity; 1321 - type Blurs = St::Blurs; 1321 + type Identifier = St::Identifier; 1322 1322 } 1323 1323 ///State transition - sets the `locales` field to Set 1324 1324 pub struct SetLocales<St: State = Empty>(PhantomData<fn() -> St>); 1325 1325 impl<St: State> sealed::Sealed for SetLocales<St> {} 1326 1326 impl<St: State> State for SetLocales<St> { 1327 - type Identifier = St::Identifier; 1327 + type Blurs = St::Blurs; 1328 1328 type Locales = Set<members::locales>; 1329 1329 type Severity = St::Severity; 1330 - type Blurs = St::Blurs; 1330 + type Identifier = St::Identifier; 1331 1331 } 1332 1332 ///State transition - sets the `severity` field to Set 1333 1333 pub struct SetSeverity<St: State = Empty>(PhantomData<fn() -> St>); 1334 1334 impl<St: State> sealed::Sealed for SetSeverity<St> {} 1335 1335 impl<St: State> State for SetSeverity<St> { 1336 - type Identifier = St::Identifier; 1336 + type Blurs = St::Blurs; 1337 1337 type Locales = St::Locales; 1338 1338 type Severity = Set<members::severity>; 1339 - type Blurs = St::Blurs; 1340 - } 1341 - ///State transition - sets the `blurs` field to Set 1342 - pub struct SetBlurs<St: State = Empty>(PhantomData<fn() -> St>); 1343 - impl<St: State> sealed::Sealed for SetBlurs<St> {} 1344 - impl<St: State> State for SetBlurs<St> { 1345 1339 type Identifier = St::Identifier; 1340 + } 1341 + ///State transition - sets the `identifier` field to Set 1342 + pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>); 1343 + impl<St: State> sealed::Sealed for SetIdentifier<St> {} 1344 + impl<St: State> State for SetIdentifier<St> { 1345 + type Blurs = St::Blurs; 1346 1346 type Locales = St::Locales; 1347 1347 type Severity = St::Severity; 1348 - type Blurs = Set<members::blurs>; 1348 + type Identifier = Set<members::identifier>; 1349 1349 } 1350 1350 /// Marker types for field names 1351 1351 #[allow(non_camel_case_types)] 1352 1352 pub mod members { 1353 - ///Marker type for the `identifier` field 1354 - pub struct identifier(()); 1353 + ///Marker type for the `blurs` field 1354 + pub struct blurs(()); 1355 1355 ///Marker type for the `locales` field 1356 1356 pub struct locales(()); 1357 1357 ///Marker type for the `severity` field 1358 1358 pub struct severity(()); 1359 - ///Marker type for the `blurs` field 1360 - pub struct blurs(()); 1359 + ///Marker type for the `identifier` field 1360 + pub struct identifier(()); 1361 1361 } 1362 1362 } 1363 1363 ··· 1516 1516 impl<S: BosStr, St> LabelValueDefinitionBuilder<S, St> 1517 1517 where 1518 1518 St: label_value_definition_state::State, 1519 - St::Identifier: label_value_definition_state::IsSet, 1519 + St::Blurs: label_value_definition_state::IsSet, 1520 1520 St::Locales: label_value_definition_state::IsSet, 1521 1521 St::Severity: label_value_definition_state::IsSet, 1522 - St::Blurs: label_value_definition_state::IsSet, 1522 + St::Identifier: label_value_definition_state::IsSet, 1523 1523 { 1524 1524 /// Build the final struct. 1525 1525 pub fn build(self) -> LabelValueDefinition<S> { ··· 1560 1560 } 1561 1561 /// State trait tracking which required fields have been set 1562 1562 pub trait State: sealed::Sealed { 1563 - type Description; 1564 - type Lang; 1565 1563 type Name; 1564 + type Lang; 1565 + type Description; 1566 1566 } 1567 1567 /// Empty state - all required fields are unset 1568 1568 pub struct Empty(()); 1569 1569 impl sealed::Sealed for Empty {} 1570 1570 impl State for Empty { 1571 - type Description = Unset; 1571 + type Name = Unset; 1572 1572 type Lang = Unset; 1573 - type Name = Unset; 1573 + type Description = Unset; 1574 1574 } 1575 - ///State transition - sets the `description` field to Set 1576 - pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 1577 - impl<St: State> sealed::Sealed for SetDescription<St> {} 1578 - impl<St: State> State for SetDescription<St> { 1579 - type Description = Set<members::description>; 1575 + ///State transition - sets the `name` field to Set 1576 + pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>); 1577 + impl<St: State> sealed::Sealed for SetName<St> {} 1578 + impl<St: State> State for SetName<St> { 1579 + type Name = Set<members::name>; 1580 1580 type Lang = St::Lang; 1581 - type Name = St::Name; 1581 + type Description = St::Description; 1582 1582 } 1583 1583 ///State transition - sets the `lang` field to Set 1584 1584 pub struct SetLang<St: State = Empty>(PhantomData<fn() -> St>); 1585 1585 impl<St: State> sealed::Sealed for SetLang<St> {} 1586 1586 impl<St: State> State for SetLang<St> { 1587 - type Description = St::Description; 1588 - type Lang = Set<members::lang>; 1589 1587 type Name = St::Name; 1590 - } 1591 - ///State transition - sets the `name` field to Set 1592 - pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>); 1593 - impl<St: State> sealed::Sealed for SetName<St> {} 1594 - impl<St: State> State for SetName<St> { 1588 + type Lang = Set<members::lang>; 1595 1589 type Description = St::Description; 1590 + } 1591 + ///State transition - sets the `description` field to Set 1592 + pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 1593 + impl<St: State> sealed::Sealed for SetDescription<St> {} 1594 + impl<St: State> State for SetDescription<St> { 1595 + type Name = St::Name; 1596 1596 type Lang = St::Lang; 1597 - type Name = Set<members::name>; 1597 + type Description = Set<members::description>; 1598 1598 } 1599 1599 /// Marker types for field names 1600 1600 #[allow(non_camel_case_types)] 1601 1601 pub mod members { 1602 - ///Marker type for the `description` field 1603 - pub struct description(()); 1604 - ///Marker type for the `lang` field 1605 - pub struct lang(()); 1606 1602 ///Marker type for the `name` field 1607 1603 pub struct name(()); 1604 + ///Marker type for the `lang` field 1605 + pub struct lang(()); 1606 + ///Marker type for the `description` field 1607 + pub struct description(()); 1608 1608 } 1609 1609 } 1610 1610 ··· 1710 1710 impl<S: BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1711 1711 where 1712 1712 St: label_value_definition_strings_state::State, 1713 - St::Description: label_value_definition_strings_state::IsSet, 1714 - St::Lang: label_value_definition_strings_state::IsSet, 1715 1713 St::Name: label_value_definition_strings_state::IsSet, 1714 + St::Lang: label_value_definition_strings_state::IsSet, 1715 + St::Description: label_value_definition_strings_state::IsSet, 1716 1716 { 1717 1717 /// Build the final struct. 1718 1718 pub fn build(self) -> LabelValueDefinitionStrings<S> {
+13 -13
crates/jacquard-codegen-tests/src/generated/pretty/com_atproto/repo/strong_ref.rs
··· 59 59 } 60 60 /// State trait tracking which required fields have been set 61 61 pub trait State: sealed::Sealed { 62 - type Uri; 63 62 type Cid; 63 + type Uri; 64 64 } 65 65 /// Empty state - all required fields are unset 66 66 pub struct Empty(()); 67 67 impl sealed::Sealed for Empty {} 68 68 impl State for Empty { 69 - type Uri = Unset; 70 69 type Cid = Unset; 71 - } 72 - ///State transition - sets the `uri` field to Set 73 - pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 74 - impl<St: State> sealed::Sealed for SetUri<St> {} 75 - impl<St: State> State for SetUri<St> { 76 - type Uri = Set<members::uri>; 77 - type Cid = St::Cid; 70 + type Uri = Unset; 78 71 } 79 72 ///State transition - sets the `cid` field to Set 80 73 pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>); 81 74 impl<St: State> sealed::Sealed for SetCid<St> {} 82 75 impl<St: State> State for SetCid<St> { 83 - type Uri = St::Uri; 84 76 type Cid = Set<members::cid>; 77 + type Uri = St::Uri; 78 + } 79 + ///State transition - sets the `uri` field to Set 80 + pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 81 + impl<St: State> sealed::Sealed for SetUri<St> {} 82 + impl<St: State> State for SetUri<St> { 83 + type Cid = St::Cid; 84 + type Uri = Set<members::uri>; 85 85 } 86 86 /// Marker types for field names 87 87 #[allow(non_camel_case_types)] 88 88 pub mod members { 89 - ///Marker type for the `uri` field 90 - pub struct uri(()); 91 89 ///Marker type for the `cid` field 92 90 pub struct cid(()); 91 + ///Marker type for the `uri` field 92 + pub struct uri(()); 93 93 } 94 94 } 95 95 ··· 159 159 impl<S: BosStr, St> StrongRefBuilder<S, St> 160 160 where 161 161 St: strong_ref_state::State, 162 - St::Uri: strong_ref_state::IsSet, 163 162 St::Cid: strong_ref_state::IsSet, 163 + St::Uri: strong_ref_state::IsSet, 164 164 { 165 165 /// Build the final struct. 166 166 pub fn build(self) -> StrongRef<S> {
+13 -13
crates/jacquard-codegen-tests/src/generated/pretty/test_ns3/collision.rs
··· 298 298 } 299 299 /// State trait tracking which required fields have been set 300 300 pub trait State: sealed::Sealed { 301 - type ExternalFoo; 302 301 type LocalFoo; 302 + type ExternalFoo; 303 303 } 304 304 /// Empty state - all required fields are unset 305 305 pub struct Empty(()); 306 306 impl sealed::Sealed for Empty {} 307 307 impl State for Empty { 308 - type ExternalFoo = Unset; 309 308 type LocalFoo = Unset; 310 - } 311 - ///State transition - sets the `external_foo` field to Set 312 - pub struct SetExternalFoo<St: State = Empty>(PhantomData<fn() -> St>); 313 - impl<St: State> sealed::Sealed for SetExternalFoo<St> {} 314 - impl<St: State> State for SetExternalFoo<St> { 315 - type ExternalFoo = Set<members::external_foo>; 316 - type LocalFoo = St::LocalFoo; 309 + type ExternalFoo = Unset; 317 310 } 318 311 ///State transition - sets the `local_foo` field to Set 319 312 pub struct SetLocalFoo<St: State = Empty>(PhantomData<fn() -> St>); 320 313 impl<St: State> sealed::Sealed for SetLocalFoo<St> {} 321 314 impl<St: State> State for SetLocalFoo<St> { 322 - type ExternalFoo = St::ExternalFoo; 323 315 type LocalFoo = Set<members::local_foo>; 316 + type ExternalFoo = St::ExternalFoo; 317 + } 318 + ///State transition - sets the `external_foo` field to Set 319 + pub struct SetExternalFoo<St: State = Empty>(PhantomData<fn() -> St>); 320 + impl<St: State> sealed::Sealed for SetExternalFoo<St> {} 321 + impl<St: State> State for SetExternalFoo<St> { 322 + type LocalFoo = St::LocalFoo; 323 + type ExternalFoo = Set<members::external_foo>; 324 324 } 325 325 /// Marker types for field names 326 326 #[allow(non_camel_case_types)] 327 327 pub mod members { 328 - ///Marker type for the `external_foo` field 329 - pub struct external_foo(()); 330 328 ///Marker type for the `local_foo` field 331 329 pub struct local_foo(()); 330 + ///Marker type for the `external_foo` field 331 + pub struct external_foo(()); 332 332 } 333 333 } 334 334 ··· 411 411 impl<S: BosStr, St> CollisionBuilder<S, St> 412 412 where 413 413 St: collision_state::State, 414 - St::ExternalFoo: collision_state::IsSet, 415 414 St::LocalFoo: collision_state::IsSet, 415 + St::ExternalFoo: collision_state::IsSet, 416 416 { 417 417 /// Build the final struct. 418 418 pub fn build(self) -> Collision<S> {
+1 -2
crates/jacquard-identity/Cargo.toml
··· 41 41 tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } 42 42 43 43 44 - [target.'cfg(target_arch = "wasm32")'.dependencies] 45 - mini-moka = { package = "mini-moka-wasm", version = "0.10",path = "../mini-moka-wasm", features = ["js"], optional = true } 44 + 46 45 #ring = { version = "0.17", default-features = false, features = ["wasm32_unknown_unknown_js"]} 47 46 48 47 [[example]]
+2 -2
crates/jacquard-identity/src/lib.rs
··· 647 647 .unwrap_or_default(); 648 648 let url_str = if qs.is_empty() { 649 649 format!( 650 - "{}xrpc/com.bad-example.identity.resolveMiniDoc", 650 + "{}xrpc/blue.microcosm.identity.resolveMiniDoc", 651 651 base.as_str().trim_end_matches('/').to_string() + "/" 652 652 ) 653 653 } else { 654 654 format!( 655 - "{}xrpc/com.bad-example.identity.resolveMiniDoc?{}", 655 + "{}xrpc/blue.microcosm.identity.resolveMiniDoc?{}", 656 656 base.as_str().trim_end_matches('/').to_string() + "/", 657 657 qs 658 658 )
+6 -5
crates/jacquard-repo/src/mst/util.rs
··· 11 11 use bytes::Bytes; 12 12 use cid::Cid as IpldCid; 13 13 use sha2::{Digest, Sha256}; 14 + use smol_str::{SmolStr, ToSmolStr, format_smolstr}; 14 15 15 16 /// Compute CID from raw bytes 16 17 /// ··· 129 130 } 130 131 131 132 // Process remaining entries 132 - let mut last_key = String::new(); 133 + let mut last_key = SmolStr::new(""); 133 134 while i < entries.len() { 134 135 let entry = &entries[i]; 135 136 ··· 160 161 tree: tree_ptr, 161 162 }); 162 163 163 - last_key = key.as_str().to_string(); 164 + last_key = key.as_str().to_smolstr(); 164 165 } else { 165 166 return Err( 166 167 MstError::InvalidNode("Two Trees adjacent in flat entries".into()).into(), ··· 196 197 } 197 198 198 199 // Process entries 199 - let mut last_key = String::new(); 200 + let mut last_key = SmolStr::new(""); 200 201 for entry in &data.entries { 201 202 // Reconstruct full key from prefix 202 203 let key_str = std::str::from_utf8(&entry.key_suffix) 203 204 .map_err(|e| MstError::InvalidNode(format!("Invalid UTF-8 in key suffix: {}", e)))?; 204 205 let prefix_len = entry.prefix_len as usize; 205 - let full_key = format!("{}{}", &last_key[..prefix_len], key_str); 206 + let full_key = format_smolstr!("{}{}", &last_key[..prefix_len], key_str); 206 207 207 208 // Append Leaf 208 209 entries.push(NodeEntry::Leaf { 209 - key: smol_str::SmolStr::new(&full_key), 210 + key: full_key.clone(), 210 211 value: entry.value, 211 212 }); 212 213
+173 -19
crates/jacquard-repo/src/repo.rs
··· 332 332 Ok(old_cid) 333 333 } 334 334 335 - // TODO(cursor-based queries): Potential future API additions 336 - // 337 - // The current API is purely single-record CRUD. Cursor-based traversal (see mst/cursor.rs) 338 - // would enable efficient collection/range queries: 339 - // 340 - // - list_collection(collection: &Nsid) -> Vec<(RecordKey, IpldCid)> 341 - // Enumerate all records in a collection via prefix search on "collection/" 342 - // Uses cursor.advance() + cursor.skip_subtree() to skip irrelevant branches 343 - // 344 - // - list_collection_range(collection: &Nsid, start: &Rkey, end: &Rkey) -> Vec<...> 345 - // Range query: advance to start key, collect until > end, skip subtrees outside range 346 - // Useful for pagination / time-bounded queries (since Rkeys are often TIDs) 347 - // 348 - // - list_all_collections() -> Vec<Nsid> 349 - // Walk tree, track collection prefixes, skip subtrees once prefix changes 350 - // 351 - // Current single-key get() is already optimal (O(log n) targeted lookup). 352 - // But these bulk operations would benefit significantly from cursor's skip_subtree() 353 - // to avoid traversing unrelated branches when searching lexicographically-organized data. 335 + /// List all records in a collection. 336 + /// 337 + /// Returns `(rkey, cid)` pairs for every record under the given collection 338 + /// NSID, sorted lexicographically by rkey. Uses cursor-based traversal with 339 + /// subtree skipping for efficiency on large repositories. 340 + pub async fn list_collection( 341 + &self, 342 + collection: &Nsid<S>, 343 + ) -> Result<Vec<(smol_str::SmolStr, IpldCid)>> { 344 + use crate::mst::cursor::{CursorPosition, MstCursor}; 345 + 346 + let prefix = format!("{}/", collection.as_ref()); 347 + let mut cursor = MstCursor::new(self.mst.clone()); 348 + let mut results = Vec::new(); 349 + 350 + // Step into the root 351 + cursor.advance().await?; 352 + 353 + while !cursor.is_end() { 354 + match cursor.current().clone() { 355 + CursorPosition::Leaf { key, cid } => { 356 + if key.starts_with(&prefix) { 357 + let rkey = smol_str::SmolStr::new(&key[prefix.len()..]); 358 + results.push((rkey, cid)); 359 + } else if key.as_str() > prefix.as_str() { 360 + // Past the collection lexicographically — done 361 + break; 362 + } 363 + cursor.advance().await?; 364 + } 365 + CursorPosition::Tree { .. } => { 366 + cursor.advance().await?; 367 + } 368 + CursorPosition::End => break, 369 + } 370 + } 371 + 372 + Ok(results) 373 + } 374 + 375 + /// List all records in a collection with their data. 376 + /// 377 + /// Like [`list_collection`](Self::list_collection) but also reads each 378 + /// record's block data from storage and returns it as raw bytes. Records 379 + /// whose blocks are missing from storage are silently skipped. 380 + pub async fn list_collection_data( 381 + &self, 382 + collection: &Nsid<S>, 383 + ) -> Result<Vec<(smol_str::SmolStr, IpldCid, Bytes)>> { 384 + let entries = self.list_collection(collection).await?; 385 + let mut results = Vec::with_capacity(entries.len()); 386 + 387 + for (rkey, cid) in entries { 388 + if let Some(data) = self.storage.get(&cid).await? { 389 + results.push((rkey, cid, data)); 390 + } 391 + } 392 + 393 + Ok(results) 394 + } 354 395 355 396 /// Create a commit from record write operations 356 397 /// ··· 1266 1307 .unwrap() 1267 1308 .is_some() 1268 1309 ); 1310 + } 1311 + 1312 + #[tokio::test] 1313 + async fn test_list_collection() { 1314 + use crate::mst::RecordWriteOp; 1315 + 1316 + let storage = Arc::new(MemoryBlockStore::new()); 1317 + let mut repo = create_test_repo(storage.clone()).await; 1318 + 1319 + let posts = Nsid::new("app.bsky.feed.post").unwrap().into_static(); 1320 + let likes = Nsid::new("app.bsky.feed.like").unwrap().into_static(); 1321 + let did = Did::new("did:plc:test").unwrap().into_static(); 1322 + let signing_key = k256::ecdsa::SigningKey::random(&mut rand::rngs::OsRng); 1323 + 1324 + let ops = vec![ 1325 + RecordWriteOp::Create { 1326 + collection: posts.clone(), 1327 + rkey: RecordKey(Rkey::new("aaa").unwrap()).into_static(), 1328 + record: make_test_record(1), 1329 + }, 1330 + RecordWriteOp::Create { 1331 + collection: posts.clone(), 1332 + rkey: RecordKey(Rkey::new("bbb").unwrap()).into_static(), 1333 + record: make_test_record(2), 1334 + }, 1335 + RecordWriteOp::Create { 1336 + collection: posts.clone(), 1337 + rkey: RecordKey(Rkey::new("ccc").unwrap()).into_static(), 1338 + record: make_test_record(3), 1339 + }, 1340 + RecordWriteOp::Create { 1341 + collection: likes.clone(), 1342 + rkey: RecordKey(Rkey::new("zzz").unwrap()).into_static(), 1343 + record: make_test_record(4), 1344 + }, 1345 + ]; 1346 + 1347 + let (_, commit_data) = repo 1348 + .create_commit( 1349 + &ops, 1350 + &did, 1351 + Some(repo.current_commit_cid().clone()), 1352 + &signing_key, 1353 + ) 1354 + .await 1355 + .unwrap(); 1356 + repo.apply_commit(commit_data).await.unwrap(); 1357 + 1358 + // List posts — should get 3 entries 1359 + let post_entries = repo.list_collection(&posts).await.unwrap(); 1360 + assert_eq!(post_entries.len(), 3); 1361 + let rkeys: Vec<&str> = post_entries.iter().map(|(k, _)| k.as_str()).collect(); 1362 + assert_eq!(rkeys, vec!["aaa", "bbb", "ccc"]); 1363 + 1364 + // List likes — should get 1 entry 1365 + let like_entries = repo.list_collection(&likes).await.unwrap(); 1366 + assert_eq!(like_entries.len(), 1); 1367 + assert_eq!(like_entries[0].0.as_str(), "zzz"); 1368 + 1369 + // List nonexistent collection — should get 0 entries 1370 + let empty_nsid = Nsid::new("app.bsky.graph.follow").unwrap().into_static(); 1371 + let empty = repo.list_collection(&empty_nsid).await.unwrap(); 1372 + assert!(empty.is_empty()); 1373 + } 1374 + 1375 + #[tokio::test] 1376 + async fn test_list_collection_data() { 1377 + use crate::mst::RecordWriteOp; 1378 + 1379 + let storage = Arc::new(MemoryBlockStore::new()); 1380 + let mut repo = create_test_repo(storage.clone()).await; 1381 + 1382 + let posts = Nsid::new("app.bsky.feed.post").unwrap().into_static(); 1383 + let did = Did::new("did:plc:test").unwrap().into_static(); 1384 + let signing_key = k256::ecdsa::SigningKey::random(&mut rand::rngs::OsRng); 1385 + 1386 + let ops = vec![ 1387 + RecordWriteOp::Create { 1388 + collection: posts.clone(), 1389 + rkey: RecordKey(Rkey::new("post1").unwrap()).into_static(), 1390 + record: make_test_record(1), 1391 + }, 1392 + RecordWriteOp::Create { 1393 + collection: posts.clone(), 1394 + rkey: RecordKey(Rkey::new("post2").unwrap()).into_static(), 1395 + record: make_test_record(2), 1396 + }, 1397 + ]; 1398 + 1399 + let (_, commit_data) = repo 1400 + .create_commit( 1401 + &ops, 1402 + &did, 1403 + Some(repo.current_commit_cid().clone()), 1404 + &signing_key, 1405 + ) 1406 + .await 1407 + .unwrap(); 1408 + repo.apply_commit(commit_data).await.unwrap(); 1409 + 1410 + let entries = repo.list_collection_data(&posts).await.unwrap(); 1411 + assert_eq!(entries.len(), 2); 1412 + 1413 + // Verify we can deserialize the record data 1414 + for (rkey, _cid, data) in &entries { 1415 + let record: BTreeMap<SmolStr, RawData> = 1416 + serde_ipld_dagcbor::from_slice(data).unwrap(); 1417 + assert_eq!( 1418 + record.get(&SmolStr::new("$type")).unwrap(), 1419 + &RawData::String("app.bsky.feed.post".into()) 1420 + ); 1421 + assert!(rkey.as_str() == "post1" || rkey.as_str() == "post2"); 1422 + } 1269 1423 } 1270 1424 }