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

Implements TyrFrom for Deque from array #524

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hicklin
Copy link

@hicklin hicklin commented Dec 16, 2024

Fixes #522.

Ideally, this PR is updated after PR #521 is merged to simplify the tests.

This PR implements the TryFrom trait for creating a Deque from a slice.

Note the use of unsafe for copying all bytes from the slice to the Deque buffer after ensuring that the Deque buffer has enough space.

Also note the use of ManuallyDrop to ensure that any heap memory referred to by the element contents is not dropped at the end of this method since the elements in the Deque buffer will be pointing to it.

@hicklin hicklin changed the title Implemented TyrFrom for Deque from slice. Implements TyrFrom for Deque from array. Jan 9, 2025
@hicklin hicklin changed the title Implements TyrFrom for Deque from array. Implements TyrFrom for Deque from array Jan 9, 2025
Copy link
Member

@newAM newAM left a comment

Choose a reason for hiding this comment

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

I wont be able to properly review this for a bit, wanted to highlight a couple typos until then.

src/deque.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@hicklin hicklin requested a review from newAM January 14, 2025 11:51
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.

Implement the From or TryFrom traits for Deque
2 participants