pub enum Target {
National,
Postcode(String),
Region(Region),
}
Expand description
Carbon intensity target, e.g. a postcode or a region
Variants§
Trait Implementations§
Source§impl From<String> for Target
Creates a Target
from a String
impl From<String> for Target
Creates a Target
from a String
If the string is equal to ‘national’ or is empty returns Target::National. If it contains a valid
Regionid this returns a
Target::Region, otherwise it returns a
Target::Postcode`.
Note how this is infallible because it balls back to Target::Postcode
.
let target = Target::from("13".to_string());
assert_eq!(target, Target::Region(Region::London));
let target = Target::from("BS7".to_string());
let bs7 = Target::Postcode("BS7".to_string());
assert_eq!(target, bs7);
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl Freeze for Target
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnwindSafe for Target
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.