@@ -5,16 +5,17 @@ use std::str::FromStr;
5
5
6
6
use serde:: { Deserialize , Serialize } ;
7
7
8
- use crate :: entity :: StorageIndex ;
8
+ use crate :: StorageIndex ;
9
9
use crate :: error:: { Error , Result } ;
10
- use crate :: { CompName , EntityName , VarName , VarType } ;
10
+ use crate :: var:: VarType ;
11
+ use crate :: { CompName , EntityName , VarName } ;
11
12
12
13
pub const SEPARATOR_SYMBOL : & ' static str = "." ;
13
14
14
15
/// Entity-scope address that can also handle component-scope locality.
15
16
#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
16
17
#[ cfg_attr(
17
- feature = "archive " ,
18
+ feature = "rkyv " ,
18
19
derive( rkyv:: Archive , rkyv:: Serialize , rkyv:: Deserialize )
19
20
) ]
20
21
pub struct ShortLocalAddress {
@@ -60,7 +61,7 @@ impl ShortLocalAddress {
60
61
var_name : s. to_owned ( ) ,
61
62
} )
62
63
} else {
63
- Err ( Error :: InvalidData ( "" . to_owned ( ) ) )
64
+ Err ( Error :: Other ( "" . to_owned ( ) ) )
64
65
}
65
66
}
66
67
@@ -140,10 +141,10 @@ impl ShortLocalAddress {
140
141
#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
141
142
#[ cfg_attr( feature = "small_stringid" , derive( Copy ) ) ]
142
143
#[ cfg_attr(
143
- feature = "archive " ,
144
+ feature = "rkyv " ,
144
145
derive( rkyv:: Archive , rkyv:: Serialize , rkyv:: Deserialize )
145
146
) ]
146
- #[ cfg_attr( feature = "archive " , rkyv( derive( Hash , PartialEq , Eq ) ) ) ]
147
+ #[ cfg_attr( feature = "rkyv " , rkyv( derive( Hash , PartialEq , Eq ) ) ) ]
147
148
pub struct LocalAddress {
148
149
pub comp : CompName ,
149
150
pub var_type : VarType ,
@@ -193,10 +194,10 @@ impl LocalAddress {
193
194
/// Globally unique reference to simulation variable.
194
195
#[ derive( Debug , Hash , Eq , PartialEq , Clone , Serialize , Deserialize ) ]
195
196
#[ cfg_attr(
196
- feature = "archive " ,
197
+ feature = "rkyv " ,
197
198
derive( rkyv:: Archive , rkyv:: Serialize , rkyv:: Deserialize )
198
199
) ]
199
- #[ cfg_attr( feature = "archive " , rkyv( derive( Hash , PartialEq , Eq ) ) ) ]
200
+ #[ cfg_attr( feature = "rkyv " , rkyv( derive( Hash , PartialEq , Eq ) ) ) ]
200
201
pub struct Address {
201
202
pub entity : EntityName ,
202
203
pub comp : CompName ,
@@ -227,7 +228,7 @@ impl FromStr for Address {
227
228
fn from_str ( s : & str ) -> std:: result:: Result < Self , Self :: Err > {
228
229
let split = s. split ( SEPARATOR_SYMBOL ) . collect :: < Vec < & str > > ( ) ;
229
230
if split. len ( ) != 4 {
230
- return Err ( Error :: FailedCreatingAddress ( s. to_string ( ) ) ) ;
231
+ return Err ( Error :: InvalidAddress ( s. to_string ( ) ) ) ;
231
232
}
232
233
Ok ( Address {
233
234
entity : split[ 0 ] . to_owned ( ) ,
@@ -265,7 +266,7 @@ impl Address {
265
266
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
266
267
#[ cfg_attr( feature = "small_stringid" , derive( Copy ) ) ]
267
268
#[ cfg_attr(
268
- feature = "archive " ,
269
+ feature = "rkyv " ,
269
270
derive( rkyv:: Archive , rkyv:: Serialize , rkyv:: Deserialize )
270
271
) ]
271
272
pub struct PartialAddress {
@@ -298,7 +299,7 @@ impl FromStr for PartialAddress {
298
299
var_name : split[ 2 ] . to_owned ( ) ,
299
300
} )
300
301
} else {
301
- Err ( Error :: FailedCreatingAddress ( s. to_string ( ) ) )
302
+ Err ( Error :: InvalidPartialAddress ( s. to_string ( ) ) )
302
303
}
303
304
}
304
305
}
0 commit comments