Skip to content

Commit

Permalink
docs, zerofrom is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Feb 26, 2025
1 parent 252f6ad commit 175154f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
5 changes: 1 addition & 4 deletions provider/core/src/data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,8 @@ mod test {
// JSON string. It also exercises most of the data provider code paths.

/// A data struct serialization-compatible with HelloWorld used for testing mismatched types
#[derive(
Serialize, Deserialize, Debug, Clone, Default, PartialEq, yoke::Yokeable, zerofrom::ZeroFrom,
)]
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, yoke::Yokeable)]
pub struct HelloAlt {
#[zerofrom(clone)]
message: String,
}

Expand Down
5 changes: 2 additions & 3 deletions provider/core/src/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ use core::fmt::Debug;
use icu_locale_core::preferences::define_preferences;
use writeable::Writeable;
use yoke::*;
use zerofrom::*;

/// A struct containing "Hello World" in the requested language.
#[derive(Debug, PartialEq, Clone, Yokeable, ZeroFrom)]
#[derive(Debug, PartialEq, Clone, Yokeable)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(
any(feature = "deserialize_json", feature = "export"),
Expand All @@ -41,7 +40,7 @@ impl Default for HelloWorld<'_> {
}
}

impl<'a> ZeroFrom<'a, str> for HelloWorld<'a> {
impl<'a> zerofrom::ZeroFrom<'a, str> for HelloWorld<'a> {
fn zero_from(message: &'a str) -> Self {
HelloWorld {
message: Cow::Borrowed(message),
Expand Down
12 changes: 2 additions & 10 deletions provider/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ use zerovec::ule::*;
/// Trait marker for data structs. All types delivered by the data provider must be associated with
/// something implementing this trait.
///
/// Structs implementing this trait are normally generated with the [`data_struct`] macro.
///
/// By convention, the non-standard `Marker` suffix is used by types implementing DynamicDataMarker.
///
/// In addition to a marker type implementing DynamicDataMarker, the following impls must also be present
/// for the data struct:
///
/// - `impl<'a> Yokeable<'a>` (required)
/// - `impl ZeroFrom<Self>`
/// Data markers normally generated with the [`data_marker`] macro.
///
/// Also see [`DataMarker`].
///
Expand All @@ -37,7 +29,7 @@ use zerovec::ule::*;
/// use icu_provider::prelude::*;
/// use std::borrow::Cow;
///
/// #[derive(yoke::Yokeable, zerofrom::ZeroFrom)]
/// #[derive(yoke::Yokeable)]
/// struct MyDataStruct<'data> {
/// message: Cow<'data, str>,
/// }
Expand Down

0 comments on commit 175154f

Please sign in to comment.