Skip to content

Commit

Permalink
unsafe impl Send for {Mecab,Njd,JpCommon}
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Apr 2, 2024
1 parent 70c76bb commit f79e685
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
@@ -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> {
3 changes: 3 additions & 0 deletions crates/open_jtalk/src/mecab/mod.rs
Original file line number Diff line number Diff line change
@@ -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() {
3 changes: 3 additions & 0 deletions crates/open_jtalk/src/njd.rs
Original file line number Diff line number Diff line change
@@ -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() {

0 comments on commit f79e685

Please sign in to comment.