Skip to content

Add _from_bytes methods to allow the direct usage of u8 byte arrays#1

Open
olliecheng wants to merge 2 commits intonlhepler:mainfrom
olliecheng:with-unsafe-addition
Open

Add _from_bytes methods to allow the direct usage of u8 byte arrays#1
olliecheng wants to merge 2 commits intonlhepler:mainfrom
olliecheng:with-unsafe-addition

Conversation

@olliecheng
Copy link
Copy Markdown

@olliecheng olliecheng commented Jul 10, 2024

Hi, thanks for your work on making this wrapper! This PR adds align_from_bytes and add_alignment_from_bytes versions of the existing AlignmentEngine::align and Graph::add_alignment methods, which take in a &[u8] byte slice instead of a CStr.

@olliecheng
Copy link
Copy Markdown
Author

olliecheng commented Jul 10, 2024

I believe that this enables better interoperability with other Rust tools and libraries. For instance, bio::io::fastq::Record stores data internally using a non-null terminated byte array. Without this change, one would have to re-allocate the byte array to include a null byte at the end before casting to a CStr, which is redundant, as it seems that spoa doesn't actually use the null byte and instead uses the sequence_len and quality_len values passed into it.

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.

1 participant