Skip to content
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

Add TryFromBytes::try_{ref,mut}_from_{bytes,prefix,suffix}_with_elems #1747

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Sep 24, 2024

Makes progress on #5

@joshlf joshlf requested a review from jswrenn September 24, 2024 14:36
@jswrenn jswrenn force-pushed the try-from-bytes-with-elems-methods branch 2 times, most recently from 5cdb8d8 to b0d1b2f Compare September 24, 2024 14:57
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 59 lines in your changes missing coverage. Please review.

Project coverage is 87.13%. Comparing base (fbb0f8b) to head (95a8ca7).

Files with missing lines Patch % Lines
src/lib.rs 0.00% 59 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1747      +/-   ##
==========================================
- Coverage   88.01%   87.13%   -0.89%     
==========================================
  Files          16       16              
  Lines        5833     5892      +59     
==========================================
  Hits         5134     5134              
- Misses        699      758      +59     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@joshlf joshlf mentioned this pull request Sep 24, 2024
87 tasks
@jswrenn jswrenn force-pushed the try-from-bytes-with-elems-methods branch from b0d1b2f to cb103be Compare September 24, 2024 20:44
@jswrenn
Copy link
Collaborator

jswrenn commented Sep 24, 2024

Hit merge when you're satisfied, @joshlf.

src/lib.rs Outdated
count: usize,
) -> Result<&mut Self, TryCastError<&mut [u8], Self>>
where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove the Immutable bound?

src/lib.rs Outdated
count: usize,
) -> Result<(&mut Self, &mut [u8]), TryCastError<&mut [u8], Self>>
where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove the Immutable bound?

src/lib.rs Outdated
count: usize,
) -> Result<(&mut [u8], &mut Self), TryCastError<&mut [u8], Self>>
where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove the Immutable bound?

src/lib.rs Outdated
/// use zerocopy::*;
/// # use zerocopy_derive::*;
///
/// #[derive(TryFromBytes, Immutable, KnownLayout)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

src/lib.rs Outdated
/// # use zerocopy_derive::*;
///
/// // The only valid value of this type is the byte `0xC0`
/// #[derive(TryFromBytes, KnownLayout, Immutable)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

src/lib.rs Outdated
/// # use zerocopy_derive::*;
///
/// // The only valid value of this type is the byte `0xC0`
/// #[derive(TryFromBytes, KnownLayout, Immutable)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

src/lib.rs Outdated
/// use zerocopy::*;
/// # use zerocopy_derive::*;
///
/// #[derive(TryFromBytes, Immutable, KnownLayout)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

src/lib.rs Outdated
/// # use zerocopy_derive::*;
///
/// // The only valid value of this type is the byte `0xC0`
/// #[derive(TryFromBytes, KnownLayout, Immutable)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

src/lib.rs Outdated
/// use zerocopy::*;
/// # use zerocopy_derive::*;
///
/// #[derive(TryFromBytes, Immutable, KnownLayout)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't derive Immutable here?

@jswrenn jswrenn force-pushed the try-from-bytes-with-elems-methods branch from cb103be to 95a8ca7 Compare September 24, 2024 21:15
@jswrenn
Copy link
Collaborator

jswrenn commented Sep 24, 2024

@joshlf joshlf enabled auto-merge September 24, 2024 21:20
@joshlf
Copy link
Member Author

joshlf commented Sep 24, 2024

Awesome, queued!

@joshlf joshlf added this pull request to the merge queue Sep 24, 2024
Merged via the queue into main with commit b24dfe6 Sep 24, 2024
86 checks passed
@joshlf joshlf deleted the try-from-bytes-with-elems-methods branch September 24, 2024 21:49
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