Closed msk closed 1 month ago
The pull request introduces significant changes across multiple files, primarily focusing on the Value
trait implementations for various structs. The return type of the value
method has been updated from Cow<[u8]>
to Vec<u8>
, simplifying the data handling by removing the Cow
wrapper. Additionally, a new associated type AsBytes<'a>
has been defined as Vec<u8>
for each of the affected structs. Import statements related to Cow
have been removed throughout the code, reflecting the shift towards direct ownership of data.
File | Change Summary |
---|---|
src/account.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added associated type AsBytes<'a> = Vec<u8> , removed borrow::Cow import. |
src/batch_info.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added associated type AsBytes<'a> = Vec<u8> , removed borrow::Cow import. |
src/scores.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added associated type AsBytes<'a> = Vec<u8> . |
src/tables.rs |
Removed borrow::Cow import, changed put and insert methods to use record.value().as_ref() , updated unique_key and value methods to return AsRef<[u8]> . |
src/tables/agent.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added associated type AsBytes<'a> = Vec<u8> , removed borrow::Cow import. |
src/tables/outlier_info.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added associated type AsBytes<'a> = Vec<u8> . |
src/tables/traffic_filter.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , added type alias RuleList = Vec<(IpNet, Option<Vec<u16>>, Option<Vec<u16>>)> . |
src/tables/trusted_domain.rs |
Updated value method return type from Cow<[u8]> to &[u8] . |
src/tables/trusted_user_agent.rs |
Updated value method return type from Cow<[u8]> to Vec<u8> , changed associated type from &'a [u8] to Vec<u8> , removed borrow::Cow import. |
UniqueKey
trait to replace Cow<[u8]>
with an associated type AsBytes<'a>
, aligning with the changes in the main PR.Value
trait's return type in database interactions, relevant to the main PR's updates on the Account
struct's value
method.refactor
In the meadow, where bytes do play,
We’ve simplified in a merry way.
No moreCow
, justVec<u8>
,
Data flows freely, as it should be!
Hops of joy, as code takes flight,
A cleaner path, oh what a sight! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 67.67%. Comparing base (
10dcfa0
) to head (ab8ad77
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Value
trait to remove the use ofCow<[u8]>
for thevalue
method's return type.AsBytes<'a>
, which allows implementations to define the return type ofunique_key
more flexibly.This refactor leads to cleaner and more efficient implementations, especially when handling values that don't require ownership transfer.
Summary by CodeRabbit
New Features
value
methods across multiple structs, now returningVec<u8>
instead ofCow<[u8]>
.AsBytes
asVec<u8>
for several implementations.RuleList
for better representation of rules in theTrafficFilter
struct.Bug Fixes
update
method for theTrustedDomain
struct.Chores
Cow
imports across multiple files to streamline the codebase.