caniuse_serde/
Support.rs

1// This file is part of caniuse-serde. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/caniuse-serde/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of caniuse-serde. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/caniuse-serde/master/COPYRIGHT.
3
4
5/// Represents details of support
6#[derive(Debug, Copy, Clone)]
7pub struct Support<'a>
8{
9	support_detail: &'a SupportDetail,
10	feature: &'a Feature<'a>,
11}
12
13impl<'a> Support<'a>
14{
15	/// How mature is support?
16	#[inline(always)]
17	pub fn maturity(&self) -> SupportMaturity
18	{
19		self.support_detail.maturity()
20	}
21	
22	/// Does support require a prefix?
23	#[inline(always)]
24	pub fn requires_prefix(&self) -> bool
25	{
26		self.support_detail.requires_prefix()
27	}
28	
29	/// Is support behind a flag or some other mechanism that isn't normally enabled in a default install?
30	#[inline(always)]
31	pub fn disabled_by_default(&self) -> bool
32	{
33		self.support_detail.disabled_by_default()
34	}
35	
36	/// Returns a list of pairs of one-based note numbers (the list itself is zero-based) and note text
37	/// Panics if the feature does not contain the note number; this is only possible if the caniuse.com database is invalid or the wrong Feature is passed
38	#[inline(always)]
39	pub fn notes(&'a self) -> Vec<(u8, &'a str)>
40	{
41		self.support_detail.notes(self.feature)
42	}
43}