services/ime-plugin-api: Implement From instead of Into

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
Jean-Pierre De Jesus DIAZ 2022-10-12 15:32:39 +02:00
parent 136aec042b
commit 91e4b9fa15
No known key found for this signature in database
GPG key ID: 6279AEC20A9524EC

View file

@ -34,16 +34,16 @@ pub struct PredictionTriggers {
/// trigger word predictions on whitespace /// trigger word predictions on whitespace
pub whitespace: bool, pub whitespace: bool,
} }
impl Into<usize> for PredictionTriggers { impl From<PredictionTriggers> for usize {
fn into(self) -> usize { fn from(pt: PredictionTriggers) -> usize {
let mut ret: usize = 0; let mut ret: usize = 0;
if self.newline { if pt.newline {
ret |= 0x1; ret |= 0x1;
} }
if self.punctuation { if pt.punctuation {
ret |= 0x2; ret |= 0x2;
} }
if self.whitespace { if pt.whitespace {
ret |= 0x4; ret |= 0x4;
} }
ret ret