• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zbraniecki / icu4x / 6815798908

09 Nov 2023 05:17PM UTC coverage: 72.607% (-2.4%) from 75.01%
6815798908

push

github

web-flow
Implement `Any/BufferProvider` for some smart pointers (#4255)

Allows storing them as a `Box<dyn Any/BufferProvider>` without using a
wrapper type that implements the trait.

44281 of 60987 relevant lines covered (72.61%)

201375.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/components/datetime/src/skeleton/runtime.rs
1
// This file is part of ICU4X. For terms of use, please see the file
2
// called LICENSE at the top level of the ICU4X source tree
3
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4

5
use crate::fields::Field;
6
use crate::skeleton::reference;
7
use alloc::vec::Vec;
8
use zerovec::ZeroVec;
9

10
#[derive(Debug, PartialEq, Clone)]
×
11
pub struct Skeleton<'data>(pub(crate) ZeroVec<'data, Field>);
×
12

13
impl From<reference::Skeleton> for Skeleton<'_> {
14
    fn from(input: reference::Skeleton) -> Self {
×
15
        let fields = input.fields_iter().copied().collect::<Vec<_>>();
×
16
        Self(ZeroVec::alloc_from_slice(&fields))
×
17
    }
×
18
}
19

20
impl<'data> From<ZeroVec<'data, Field>> for Skeleton<'data> {
21
    fn from(input: ZeroVec<'data, Field>) -> Self {
×
22
        Self(input)
×
23
    }
×
24
}
25

26
#[cfg(feature = "datagen")]
27
impl core::fmt::Display for Skeleton<'_> {
28
    fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
×
29
        use core::fmt::Write;
30
        for field in self.0.iter() {
×
31
            let ch: char = field.symbol.into();
×
32
            for _ in 0..field.length.to_len() {
×
33
                formatter.write_char(ch)?;
×
34
            }
35
        }
36
        Ok(())
×
37
    }
×
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc