Skip to content

Commit 838df94

Browse files
committed
Remove panic from member_type
1 parent 857f8eb commit 838df94

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/types/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,13 @@ macro_rules! make_postgres_type {
232232
}
233233
}
234234

235-
/// Returns the element `Type` if this `Type` is an array.
236-
///
237-
/// # Panics
238-
///
239-
/// Panics if this `Type` is not an array.
240-
pub fn member_type(&self) -> Type {
235+
/// Returns the member `Type` if this `Type` is an array.
236+
pub fn member_type(&self) -> Option<Type> {
241237
match *self {
242238
$(
243-
$(Type::$variant => Type::$member,)*
239+
$(Type::$variant => Some(Type::$member),)*
244240
)+
245-
_ => unreachable!()
241+
_ => None
246242
}
247243
}
248244
}

0 commit comments

Comments
 (0)