Add get_marker method to dc_array_t

This commit is contained in:
Alexander Krotov
2020-06-29 06:21:52 +03:00
committed by link2xt
parent 615a76f35e
commit 56518420bc
2 changed files with 12 additions and 1 deletions

View File

@@ -39,6 +39,17 @@ impl dc_array_t {
}
}
pub(crate) fn get_marker(&self, index: usize) -> Option<&str> {
match self {
Self::MsgIds(_) => None,
Self::Chat(array) => None,
Self::Locations(array) => array
.get(index)
.and_then(|location| location.marker.as_deref()),
Self::Uint(_) => None,
}
}
pub(crate) fn get_location(&self, index: usize) -> &Location {
if let Self::Locations(array) = self {
&array[index]