Struct slack_morphism::SlackIconImages
source · Fields§
§resolutions: Vec<(u32, String)>Implementations§
source§impl SlackIconImages
impl SlackIconImages
sourcepub fn new(resolutions: Vec<(u32, String)>) -> Self
pub fn new(resolutions: Vec<(u32, String)>) -> Self
Examples found in repository?
src/models/common/icon.rs (line 76)
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
fn visit_map<M>(self, mut access: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'de>,
{
let mut resolutions: Vec<(u32, String)> =
Vec::with_capacity(access.size_hint().unwrap_or(0));
while let Some(key) = access.next_key::<String>()? {
if key.starts_with(SLACK_ICON_JSON_PREFIX) {
let parsed_key: Vec<_> = key.split('_').collect();
if parsed_key.len() == 2 {
let resolution: u32 = parsed_key[1].parse().unwrap();
let value: String = access.next_value()?;
resolutions.push((resolution, value).clone());
}
}
}
Ok(SlackIconImages::new(resolutions))
}pub fn resolutions(&mut self, value: Vec<(u32, String)>) -> &mut Self
pub fn with_resolutions(self, value: Vec<(u32, String)>) -> Self
Trait Implementations§
source§impl Clone for SlackIconImages
impl Clone for SlackIconImages
source§fn clone(&self) -> SlackIconImages
fn clone(&self) -> SlackIconImages
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for SlackIconImages
impl Debug for SlackIconImages
source§impl<'de> Deserialize<'de> for SlackIconImages
impl<'de> Deserialize<'de> for SlackIconImages
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<SlackIconImagesInit> for SlackIconImages
impl From<SlackIconImagesInit> for SlackIconImages
source§fn from(value: SlackIconImagesInit) -> Self
fn from(value: SlackIconImagesInit) -> Self
Converts to this type from the input type.