-
Notifications
You must be signed in to change notification settings - Fork 213
Restructure icu_provider files #2168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b8bdc82
to
608a02e
Compare
608a02e
to
0289bd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a significant improvement over the status quo, but it's fine
I think the best way to lay these out would be to have one file for each type. ResourceKey, ResourceOptions, DataRequest, DataResponse, and DataPayload all in their own files.
provider/core/src/hello_world.rs
Outdated
|
||
/// Marker type for [`Cow`]`<str>` where the backing cart is `str`. | ||
#[allow(clippy::exhaustive_structs)] // marker type | ||
pub struct CowStrMarker; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It does not make sense to have this in hello_world
because it is not used by hello_world
. I disagree that this is a "toy" implementation; it could very well be used by data structs that contain only a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like one though. It's very easy for clients to write their own CowStrMarker
, and do we actually want to provide a non-ResourceMarker
DataMarker
as a stable type? Also, why just CowStrMarker
and not CowBytesMarker
?
I'd also be happy with removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't be heartbroken if you remove it, but anywhere it's used, we should migrate to something else. It is mostly used in docs tests. You can change those to something else like HelloWorldV1 if you prefer, or by re-defining CowStrMarker at each call site. However, namespacing it in hello_world
is not correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought: CowStrMarker has convenience functions like DataPayload::<CowStrMarker>::from_static_str
. You could achieve mostly the same goal by adding DataPayload::<HelloWorldV1Marker>::from_static_str
or HelloWorldV1::from_static_str("...").into_data_payload()
Codecov Report
@@ Coverage Diff @@
## main #2168 +/- ##
==========================================
+ Coverage 76.60% 76.61% +0.01%
==========================================
Files 400 400
Lines 32578 32565 -13
==========================================
- Hits 24955 24950 -5
+ Misses 7623 7615 -8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the location of CowStrMarker
These are some moves that I've been itching to do before #1576
resource.rs
gets dissolved as it doesn't make sense as a module name after Implement naming convention for "data provider" #1576ResourceOptions
intorequest.rs
(new)ResourceKey
,ResourceKeyHash
intokey.rs
(new)data_provider.rs
, a 900-line file, gets splitDynProvider
andResourceProvider
stayDataRequest
andDataRequestMetadata
intorequest.rs
(new)DataResponse
,DataResponseMetadata
,DataPayload
,RcWrap
intoresponse.rs
(new)data_provider/tests.rs
are added heremarker/
impls.rs
deleted,CowStrMarker
usages replaced byHelloWorldV1Marker
mod.rs
hoisted up asmarker.rs