Skip to content

Commit 996dfa6

Browse files
author
Bennett Hardwick
committed
Fix PR feedback
1 parent 763a628 commit 996dfa6

File tree

2 files changed

+4
-36
lines changed

2 files changed

+4
-36
lines changed

cryptonamo-derive/src/settings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ impl Settings {
186186
}
187187

188188
fn validate_index_type(index_type: &str, index_type_span: Span) -> Result<(), syn::Error> {
189-
if !matches!(index_type.as_ref(), "exact" | "prefix") {
189+
if matches!(index_type.as_ref(), "exact" | "prefix") {
190+
Ok(())
191+
} else {
190192
Err(syn::Error::new(
191193
index_type_span,
192194
format!("Unsupported index type: {}", index_type),
193195
))
194-
} else {
195-
Ok(())
196196
}
197197
}
198198

examples/common/user.rs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use cryptonamo::{traits::DecryptedRecord, Plaintext};
2-
use cryptonamo_derive::Cryptonamo;
1+
use cryptonamo::{traits::DecryptedRecord, Cryptonamo, Plaintext};
32
use std::collections::HashMap;
43

54
#[derive(Debug, Cryptonamo)]
@@ -29,37 +28,6 @@ impl User {
2928
}
3029
}
3130

32-
/*impl SearchableRecord for User {
33-
fn protected_indexes() -> Vec<&'static str> {
34-
vec!["name", "email#name"]
35-
}
36-
37-
fn index_by_name(name: &str) -> Option<Box<dyn ComposableIndex>> {
38-
match name {
39-
"name" => Some(Box::new(PrefixIndex::new("name", vec![], 3, 10))),
40-
"email#name" => Some(Box::new(
41-
CompoundIndex::new(ExactIndex::new("email", vec![])).and(PrefixIndex::new(
42-
"name",
43-
vec![],
44-
3,
45-
10,
46-
)),
47-
)),
48-
_ => None,
49-
}
50-
}
51-
52-
fn attribute_for_index(&self, index_name: &str) -> Option<ComposablePlaintext> {
53-
match index_name {
54-
"name" => self.name.clone().try_into().ok(),
55-
"email#name" => (self.email.clone(), self.name.clone())
56-
.try_into()
57-
.ok(),
58-
_ => None,
59-
}
60-
}
61-
}*/
62-
6331
impl DecryptedRecord for User {
6432
fn from_attributes(attributes: HashMap<String, Plaintext>) -> Self {
6533
Self {

0 commit comments

Comments
 (0)