Skip to content

Conversation

@imbrem
Copy link
Contributor

@imbrem imbrem commented Apr 25, 2023

Add EcoBytes, which is the same as EcoString but holds a raw byte vector rather than a UTF-8 string; this is implemented by making DynamicVec public.

@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2023

Codecov Report

Patch coverage: 71.94% and project coverage change: -6.91 ⚠️

Comparison is base (c3fd036) 92.21% compared to head (296c6e7) 85.31%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
- Coverage   92.21%   85.31%   -6.91%     
==========================================
  Files           4        4              
  Lines        1041     1212     +171     
==========================================
+ Hits          960     1034      +74     
- Misses         81      178      +97     
Impacted Files Coverage Δ
src/lib.rs 100.00% <ø> (ø)
src/string.rs 78.74% <24.00%> (-8.43%) ⬇️
src/bytes.rs 75.52% <75.52%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@imbrem
Copy link
Contributor Author

imbrem commented Jul 2, 2023

@reknih any updates on whether I can expect this to be merged? Thanks!

Copy link
Member

@laurmaedje laurmaedje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long wait. PRs outside typst/typst sometimes fly under my radar.

/// Returns `Err(())` if the vector's length exceeds the capacity of
/// the inline storage.
#[inline]
pub const fn try_inline(bytes: &[u8]) -> Result<Self, ()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinking returning Option would be preferrable over having () as an error.


/// Create a new, inline vector.
///
/// Panics if the vector's length exceeds the capacity of the inline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Panics if the vector's length exceeds the capacity of the inline
/// Panics if the slice's length exceeds the capacity of the inline


#[inline]
pub(crate) const fn from_inline(inline: InlineVec) -> Self {
Self(Repr { inline })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function doesn't really pull it's weight in my opinion


#[inline]
pub fn insert(&mut self, index: usize, value: u8) -> Result<(), ()> {
//TODO: optimize?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a custom implementation with ptr::copy (like in vec.rs) does make sense here.

}

#[inline]
pub fn remove(&mut self, index: usize) -> u8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above (like in vec.rs)

@laurmaedje
Copy link
Member

Could you also adjust the README and crate-level docs and briefly show EcoBytes?

@laurmaedje
Copy link
Member

Closing this due to inactivity. Feel free to reopen it if you want to continue working on this.

@laurmaedje laurmaedje closed this Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants