Skip to content

Commit 353c957

Browse files
committed
migrate to rust 2021
the only changes are prefixing unread fields in rust structs with _
1 parent b7ac62a commit 353c957

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mapirs"
33
version = "0.3.0"
44
authors = ["nig <nig@tutao.de>"]
5-
edition = "2018"
5+
edition = "2021"
66

77
[lib]
88
# dynamically linked c library (a dll)

src/structs/file_descriptor.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub struct RawMapiFileTagExt {
2626

2727
#[derive(Debug)]
2828
pub struct FileTagExtension {
29-
tag: Vec<u8>,
30-
encoding: Vec<u8>,
29+
_tag: Vec<u8>,
30+
_encoding: Vec<u8>,
3131
}
3232

3333
impl TryFrom<*const RawMapiFileTagExt> for FileTagExtension {
@@ -53,8 +53,8 @@ impl TryFrom<*const RawMapiFileTagExt> for FileTagExtension {
5353
*/
5454
let raw = unsafe { &*raw_ptr };
5555
Ok(FileTagExtension {
56-
tag: conversion::copy_c_array_to_vec(raw.lp_tag, raw.cb_tag as usize),
57-
encoding: conversion::copy_c_array_to_vec(
56+
_tag: conversion::copy_c_array_to_vec(raw.lp_tag, raw.cb_tag as usize),
57+
_encoding: conversion::copy_c_array_to_vec(
5858
raw.lp_encoding,
5959
raw.cb_encoding as usize,
6060
),
@@ -82,13 +82,13 @@ pub struct RawMapiFileDesc {
8282

8383
#[derive(Debug)]
8484
pub struct FileDescriptor {
85-
flags: MapiFileFlags,
86-
position: ULong,
85+
_flags: MapiFileFlags,
86+
_position: ULong,
8787
/// absolute path to attachment
8888
pub path_name: FilePath,
8989
/// file name to use for the attachment (if different from the name in the path)
9090
pub file_name: Option<PathBuf>,
91-
file_type: Option<FileTagExtension>,
91+
_file_type: Option<FileTagExtension>,
9292
}
9393

9494
impl TryFrom<&RawMapiFileDesc> for FileDescriptor {
@@ -100,11 +100,11 @@ impl TryFrom<&RawMapiFileDesc> for FileDescriptor {
100100
{
101101
let file_path: FilePath = FilePath::try_from(file_path)?;
102102
Ok(FileDescriptor {
103-
flags: raw.flags,
104-
position: raw.position,
103+
_flags: raw.flags,
104+
_position: raw.position,
105105
path_name: file_path,
106106
file_name: conversion::maybe_string_from_raw_ptr(raw.file_name).map(PathBuf::from),
107-
file_type: FileTagExtension::try_from(raw.file_type).ok(),
107+
_file_type: FileTagExtension::try_from(raw.file_type).ok(),
108108
})
109109
} else {
110110
Err(())
@@ -115,11 +115,11 @@ impl TryFrom<&RawMapiFileDesc> for FileDescriptor {
115115
impl FileDescriptor {
116116
pub fn new(file_path: &str, file_name: Option<&str>) -> Self {
117117
Self {
118-
flags: MapiFileFlags::empty(),
119-
position: 0,
118+
_flags: MapiFileFlags::empty(),
119+
_position: 0,
120120
path_name: FilePath::try_from(PathBuf::from(file_path)).unwrap(),
121121
file_name: file_name.map(PathBuf::from),
122-
file_type: None,
122+
_file_type: None,
123123
}
124124
}
125125

src/structs/message.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ pub struct RawMapiMessage {
4444
pub struct Message {
4545
subject: Option<String>,
4646
note_text: Option<String>,
47-
message_type: Option<String>,
48-
date_received: Option<String>,
49-
conversation_id: Option<String>,
50-
flags: MapiMessageFlags,
51-
originator: Option<RecipientDescriptor>,
47+
_message_type: Option<String>,
48+
_date_received: Option<String>,
49+
_conversation_id: Option<String>,
50+
_flags: MapiMessageFlags,
51+
_originator: Option<RecipientDescriptor>,
5252
recips: Vec<RecipientDescriptor>,
5353
files: Vec<FileDescriptor>,
5454
}
@@ -103,11 +103,11 @@ impl TryFrom<*const RawMapiMessage> for Message {
103103
Ok(Message {
104104
subject: conversion::maybe_string_from_raw_ptr(raw.subject),
105105
note_text: conversion::maybe_string_from_raw_ptr(raw.note_text),
106-
message_type: conversion::maybe_string_from_raw_ptr(raw.message_type),
107-
date_received: conversion::maybe_string_from_raw_ptr(raw.date_received),
108-
conversation_id: conversion::maybe_string_from_raw_ptr(raw.conversation_id),
109-
flags: raw.flags,
110-
originator: originator_result.ok(),
106+
_message_type: conversion::maybe_string_from_raw_ptr(raw.message_type),
107+
_date_received: conversion::maybe_string_from_raw_ptr(raw.date_received),
108+
_conversation_id: conversion::maybe_string_from_raw_ptr(raw.conversation_id),
109+
_flags: raw.flags,
110+
_originator: originator_result.ok(),
111111
recips,
112112
files,
113113
})
@@ -192,11 +192,11 @@ impl Message {
192192
Self {
193193
subject: subject.map(|s| s.to_owned()),
194194
note_text: body.map(|b| b.to_owned()),
195-
message_type: None,
196-
date_received: None,
197-
conversation_id: None,
198-
flags: MapiMessageFlags::empty(),
199-
originator: None,
195+
_message_type: None,
196+
_date_received: None,
197+
_conversation_id: None,
198+
_flags: MapiMessageFlags::empty(),
199+
_originator: None,
200200
recips: to
201201
.into_iter()
202202
.map(|t| RecipientDescriptor::new(t))
@@ -223,11 +223,11 @@ impl Message {
223223
Self {
224224
subject: None,
225225
note_text: None,
226-
message_type: None,
227-
date_received: None,
228-
conversation_id: None,
229-
flags: MapiMessageFlags::empty(),
230-
originator: None,
226+
_message_type: None,
227+
_date_received: None,
228+
_conversation_id: None,
229+
_flags: MapiMessageFlags::empty(),
230+
_originator: None,
231231
recips: vec![],
232232
files,
233233
}

src/structs/recipient_descriptor.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub struct RawMapiRecipDesc {
2222

2323
#[derive(Debug)]
2424
pub struct RecipientDescriptor {
25-
recip_class: ULong,
26-
name: String,
25+
_recip_class: ULong,
26+
_name: String,
2727
pub address: Option<String>,
28-
entry_id: Vec<u8>,
28+
_entry_id: Vec<u8>,
2929
}
3030

3131
impl TryFrom<*const RawMapiRecipDesc> for RecipientDescriptor {
@@ -70,11 +70,11 @@ impl From<&RawMapiRecipDesc> for RecipientDescriptor {
7070
});
7171

7272
RecipientDescriptor {
73-
recip_class: raw.recip_class,
74-
name: conversion::maybe_string_from_raw_ptr(raw.name)
73+
_recip_class: raw.recip_class,
74+
_name: conversion::maybe_string_from_raw_ptr(raw.name)
7575
.unwrap_or_else(|| "MISSING_RECIP_NAME".to_owned()),
7676
address,
77-
entry_id: conversion::copy_c_array_to_vec(raw.entry_id, raw.eid_size as usize),
77+
_entry_id: conversion::copy_c_array_to_vec(raw.entry_id, raw.eid_size as usize),
7878
}
7979
}
8080
}
@@ -83,10 +83,10 @@ impl RecipientDescriptor {
8383
#[cfg(test)]
8484
pub fn new(address: &str) -> Self {
8585
Self {
86-
recip_class: 0,
87-
name: "".to_owned(),
86+
_recip_class: 0,
87+
_name: "".to_owned(),
8888
address: Some(address.to_owned()),
89-
entry_id: vec![0, 0, 0, 0],
89+
_entry_id: vec![0, 0, 0, 0],
9090
}
9191
}
9292
}

0 commit comments

Comments
 (0)