Skip to content

Commit

Permalink
unsafe impl Send for {Mecab,Njd,JpCommon} (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip authored Apr 14, 2024
1 parent 40b3f5a commit e1940f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/open_jtalk/src/jpcommon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ unsafe impl resources::Resource for JpCommon {
}
}

// SAFETY: `Send`と対立する性質はないはず。
unsafe impl Send for JpCommon {}

impl<'a> Iterator for JpCommonLabelFeatureIter<'a> {
type Item = &'a str;
fn next(&mut self) -> Option<Self::Item> {
Expand Down
3 changes: 3 additions & 0 deletions crates/open_jtalk/src/mecab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ unsafe impl resources::Resource for Mecab {
}
}

// SAFETY: `Send`と対立する性質はないはず。
unsafe impl Send for Mecab {}

impl Mecab {
unsafe fn as_raw_ptr(&self) -> *mut open_jtalk_sys::Mecab {
if self.0.is_none() {
Expand Down
3 changes: 3 additions & 0 deletions crates/open_jtalk/src/njd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ unsafe impl resources::Resource for Njd {
}
}

// SAFETY: `Send`と対立する性質はないはず。
unsafe impl Send for Njd {}

impl Njd {
pub(crate) unsafe fn as_raw_ptr(&self) -> *mut open_jtalk_sys::NJD {
if self.0.is_none() {
Expand Down

0 comments on commit e1940f3

Please sign in to comment.