chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

1
vendor/zerofrom/.cargo-checksum.json vendored Normal file
View File

@@ -0,0 +1 @@
{"files":{".cargo_vcs_info.json":"fe0a4ab0dbe6e4ac4efecd96eee237d4e3b47ad3f195834ff6339b6138f92caa","Cargo.lock":"0ef3e8741dcf5421651406ef74c44b94e8968860dcbe024dd58f6609bfc47e3b","Cargo.toml":"83a794ae5d54368a14328428b87d7dfbacedfce5af37cd8f6ef7486db492916b","Cargo.toml.orig":"89f802b2f719dc4cb3e512937c4a802490cf43f415f8d4057e5c09dfd04069d3","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"cd9b9a57dff5012642ee535c46a9f05424eab903f0b9f62de8bf7f815bcd5082","src/lib.rs":"8dea607c122c1f81251643a6dc6614d6065a29781f4425b758228e5c90752b58","src/macro_impls.rs":"6b4b69bdc6b94f2abb64da0c2520d3ff74aff7d14e8b4de9e8022d7ddc951f38","src/zero_from.rs":"a41c82c9b6552880662b2ed67ada52e8c91611a90699a8f1ccb7035f4efcc85f"},"package":"50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"}

6
vendor/zerofrom/.cargo_vcs_info.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"git": {
"sha1": "f4290a877dfcb0f87cad6de4abdd65f0cbb33c9c"
},
"path_in_vcs": "utils/zerofrom"
}

68
vendor/zerofrom/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,68 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "proc-macro2"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "2.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "unicode-ident"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
[[package]]
name = "zerofrom"
version = "0.1.6"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]

68
vendor/zerofrom/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,68 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.81"
name = "zerofrom"
version = "0.1.6"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
build = false
include = [
"data/**/*",
"src/**/*",
"examples/**/*",
"benches/**/*",
"tests/**/*",
"Cargo.toml",
"LICENSE",
"README.md",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "ZeroFrom trait for constructing"
readme = "README.md"
keywords = [
"zerocopy",
"serialization",
"lifetime",
"borrow",
]
categories = [
"data-structures",
"caching",
"no-std",
]
license = "Unicode-3.0"
repository = "https://github.com/unicode-org/icu4x"
[package.metadata.docs.rs]
all-features = true
[package.metadata.workspaces]
independent = true
[features]
alloc = []
default = ["alloc"]
derive = ["dep:zerofrom-derive"]
[lib]
name = "zerofrom"
path = "src/lib.rs"
[dependencies.zerofrom-derive]
version = "0.1.3"
optional = true
default-features = false

46
vendor/zerofrom/LICENSE vendored Normal file
View File

@@ -0,0 +1,46 @@
UNICODE LICENSE V3
COPYRIGHT AND PERMISSION NOTICE
Copyright © 2020-2024 Unicode, Inc.
NOTICE TO USER: Carefully read the following legal agreement. BY
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a
copy of data files and any associated documentation (the "Data Files") or
software and any associated documentation (the "Software") to deal in the
Data Files or Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, and/or sell
copies of the Data Files or Software, and to permit persons to whom the
Data Files or Software are furnished to do so, provided that either (a)
this copyright and permission notice appear with all copies of the Data
Files or Software, or (b) this copyright and permission notice appear in
associated Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in these Data Files or Software without prior written
authorization of the copyright holder.
SPDX-License-Identifier: Unicode-3.0
Portions of ICU4X may have been adapted from ICU4C and/or ICU4J.
ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others.

13
vendor/zerofrom/README.md vendored Normal file
View File

@@ -0,0 +1,13 @@
# zerofrom [![crates.io](https://img.shields.io/crates/v/zerofrom)](https://crates.io/crates/zerofrom)
<!-- cargo-rdme start -->
This crate provides [`ZeroFrom`], a trait for converting types in a zero-copy way.
See the documentation of [`ZeroFrom`] for more details.
<!-- cargo-rdme end -->
## More Information
For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).

37
vendor/zerofrom/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,37 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
//! This crate provides [`ZeroFrom`], a trait for converting types in a zero-copy way.
//!
//! See the documentation of [`ZeroFrom`] for more details.
// https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations
#![cfg_attr(not(any(test, doc)), no_std)]
#![cfg_attr(
not(test),
deny(
clippy::indexing_slicing,
clippy::unwrap_used,
clippy::expect_used,
clippy::panic,
clippy::exhaustive_structs,
clippy::exhaustive_enums,
clippy::trivially_copy_pass_by_ref,
missing_debug_implementations,
)
)]
// The lifetimes here are important for safety and explicitly writing
// them out is good even when redundant
#![allow(clippy::needless_lifetimes)]
#[cfg(feature = "alloc")]
extern crate alloc;
mod macro_impls;
mod zero_from;
#[cfg(feature = "derive")]
pub use zerofrom_derive::ZeroFrom;
pub use crate::zero_from::ZeroFrom;

145
vendor/zerofrom/src/macro_impls.rs vendored Normal file
View File

@@ -0,0 +1,145 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
// In this case consistency between impls is more important
// than using pointer casts
#![allow(clippy::transmute_ptr_to_ptr)]
use crate::ZeroFrom;
macro_rules! impl_copy_type {
($ty:ident) => {
impl<'a> ZeroFrom<'a, $ty> for $ty {
#[inline]
fn zero_from(this: &'a Self) -> Self {
// Essentially only works when the struct is fully Copy
*this
}
}
};
}
impl_copy_type!(u8);
impl_copy_type!(u16);
impl_copy_type!(u32);
impl_copy_type!(u64);
impl_copy_type!(u128);
impl_copy_type!(usize);
impl_copy_type!(i8);
impl_copy_type!(i16);
impl_copy_type!(i32);
impl_copy_type!(i64);
impl_copy_type!(i128);
impl_copy_type!(isize);
impl_copy_type!(char);
impl_copy_type!(bool);
// This can be cleaned up once `[T; N]`::each_ref() is stabilized
// https://github.com/rust-lang/rust/issues/76118
macro_rules! array_zf_impl {
($n:expr; $($i:expr),+) => {
impl<'a, C, T: ZeroFrom<'a, C>> ZeroFrom<'a, [C; $n]> for [T; $n] {
fn zero_from(this: &'a [C; $n]) -> Self {
[
$(
<T as ZeroFrom<C>>::zero_from(&this[$i])
),+
]
}
}
}
}
array_zf_impl!(1; 0);
array_zf_impl!(2; 0, 1);
array_zf_impl!(3; 0, 1, 2);
array_zf_impl!(4; 0, 1, 2, 3);
array_zf_impl!(5; 0, 1, 2, 3, 4);
array_zf_impl!(6; 0, 1, 2, 3, 4, 5);
array_zf_impl!(7; 0, 1, 2, 3, 4, 5, 6);
array_zf_impl!(8; 0, 1, 2, 3, 4, 5, 6, 7);
array_zf_impl!(9; 0, 1, 2, 3, 4, 5, 6, 7, 8);
array_zf_impl!(10; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
array_zf_impl!(11; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
array_zf_impl!(12; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
array_zf_impl!(13; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
array_zf_impl!(14; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
array_zf_impl!(15; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
array_zf_impl!(16; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
macro_rules! tuple_zf_impl {
($(($c:ident, $t:ident, $i:tt)),+) => {
impl<'zf, $($c, $t: ZeroFrom<'zf, $c>),+> ZeroFrom<'zf, ($($c),+)>
for ($($t),+)
{
fn zero_from(other: &'zf ($($c),+)) -> Self {
(
$(<$t as ZeroFrom<$c>>::zero_from(&other.$i)),+
)
}
}
};
}
tuple_zf_impl!((C1, T1, 0), (C2, T2, 1));
tuple_zf_impl!((C1, T1, 0), (C2, T2, 1), (C3, T3, 2));
tuple_zf_impl!((C1, T1, 0), (C2, T2, 1), (C3, T3, 2), (C4, T4, 3));
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4)
);
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4),
(C6, T6, 5)
);
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4),
(C6, T6, 5),
(C7, T7, 6)
);
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4),
(C6, T6, 5),
(C7, T7, 6),
(C8, T8, 7)
);
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4),
(C6, T6, 5),
(C7, T7, 6),
(C8, T8, 7),
(C9, T9, 8)
);
tuple_zf_impl!(
(C1, T1, 0),
(C2, T2, 1),
(C3, T3, 2),
(C4, T4, 3),
(C5, T5, 4),
(C6, T6, 5),
(C7, T7, 6),
(C8, T8, 7),
(C9, T9, 8),
(C10, T10, 9)
);

136
vendor/zerofrom/src/zero_from.rs vendored Normal file
View File

@@ -0,0 +1,136 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
use core::marker::PhantomData;
#[cfg(feature = "alloc")]
use alloc::borrow::{Cow, ToOwned};
#[cfg(feature = "alloc")]
use alloc::string::String;
/// Trait for types that can be created from a reference to a different type `C` with no allocations,
/// i.e. a zero-copy (zero-alloc) version of "From"
///
/// A type can be the `ZeroFrom` target of multiple other types.
///
/// The intention is for `ZeroFrom` to produce a struct from a other with as little work as
/// possible. Although it is technically possible to implement `ZeroFrom` without being
/// zero-copy (using heap allocations), doing so defeats the purpose of `ZeroFrom`.
///
/// For example, `impl ZeroFrom<C> for Cow<str>` should return a `Cow::Borrowed` pointing at
/// data in the other type `C`, even if the other type is itself fully owned.
///
/// One can use the [`#[derive(ZeroFrom)]`](zerofrom_derive::ZeroFrom) custom derive to automatically
/// implement this trait.
///
/// # Examples
///
/// Implementing `ZeroFrom` on a custom data struct:
///
/// ```
/// use std::borrow::Cow;
/// use zerofrom::ZeroFrom;
///
/// struct MyStruct<'data> {
/// message: Cow<'data, str>,
/// }
///
/// // Reference from a borrowed version of self
/// impl<'zf> ZeroFrom<'zf, MyStruct<'_>> for MyStruct<'zf> {
/// fn zero_from(other: &'zf MyStruct<'_>) -> Self {
/// MyStruct {
/// message: Cow::Borrowed(&other.message),
/// }
/// }
/// }
///
/// // Reference from a string slice directly
/// impl<'zf> ZeroFrom<'zf, str> for MyStruct<'zf> {
/// fn zero_from(other: &'zf str) -> Self {
/// MyStruct {
/// message: Cow::Borrowed(other),
/// }
/// }
/// }
/// ```
pub trait ZeroFrom<'zf, C: ?Sized>: 'zf {
/// Clone the other `C` into a struct that may retain references into `C`.
fn zero_from(other: &'zf C) -> Self;
}
// Note: The following could be blanket implementations, but that would require constraining the
// blanket `T` on `T: 'static`, which may not be desirable for all downstream users who may wish
// to customize their `ZeroFrom` impl. The blanket implementation may be safe once Rust has
// specialization.
#[cfg(feature = "alloc")]
impl<'zf> ZeroFrom<'zf, str> for Cow<'zf, str> {
#[inline]
fn zero_from(other: &'zf str) -> Self {
Cow::Borrowed(other)
}
}
#[cfg(feature = "alloc")]
impl<'zf> ZeroFrom<'zf, String> for Cow<'zf, str> {
#[inline]
fn zero_from(other: &'zf String) -> Self {
Cow::Borrowed(other)
}
}
impl<'zf> ZeroFrom<'zf, str> for &'zf str {
#[inline]
fn zero_from(other: &'zf str) -> Self {
other
}
}
#[cfg(feature = "alloc")]
impl<'zf> ZeroFrom<'zf, String> for &'zf str {
#[inline]
fn zero_from(other: &'zf String) -> Self {
other
}
}
impl<'zf, C, T: ZeroFrom<'zf, C>> ZeroFrom<'zf, Option<C>> for Option<T> {
fn zero_from(other: &'zf Option<C>) -> Self {
other.as_ref().map(|c| <T as ZeroFrom<C>>::zero_from(c))
}
}
// These duplicate the functionality from above and aren't quite necessary due
// to deref coercions, however for the custom derive to work, there always needs
// to be `impl ZeroFrom<T> for T`, otherwise it may fail to perform the necessary
// type inference. Deref coercions do not typically work when sufficient generics
// or inference are involved, and the proc macro does not necessarily have
// enough type information to figure this out on its own.
#[cfg(feature = "alloc")]
impl<'zf, B: ToOwned + ?Sized> ZeroFrom<'zf, Cow<'_, B>> for Cow<'zf, B> {
#[inline]
fn zero_from(other: &'zf Cow<'_, B>) -> Self {
Cow::Borrowed(other)
}
}
impl<'zf, T: ?Sized> ZeroFrom<'zf, &'_ T> for &'zf T {
#[inline]
fn zero_from(other: &'zf &'_ T) -> &'zf T {
other
}
}
impl<'zf, T> ZeroFrom<'zf, [T]> for &'zf [T] {
#[inline]
fn zero_from(other: &'zf [T]) -> &'zf [T] {
other
}
}
impl<'zf, T: ?Sized + 'zf> ZeroFrom<'zf, PhantomData<T>> for PhantomData<T> {
fn zero_from(other: &'zf PhantomData<T>) -> Self {
*other
}
}