pub struct Contribution {
pub heat_level: usize,
}Expand description
A Contribution instance represents an invidividual heatmap node, with
a heat level corresponding to the data-level attribute set on the scraped
SVG Rect element.
Contribution instances are typically not constructed explicitly, rather created
implicitly by the higher level Heatmap struct via the from_el associated method.
Fields§
§heat_level: usizeThe heat_level property corresponds to the Rect element’s data-level attribute,
which Github uses to determine the intensity when shading the Rect element on
the front end.
The heat_level property is utilised in the same way when deciding
on the intensity of the filled Unicode box character.
Implementations§
Source§impl Contribution
impl Contribution
Sourcepub fn from_el(el: &ElementRef<'_>) -> Result<Self, HeatmapError>
pub fn from_el(el: &ElementRef<'_>) -> Result<Self, HeatmapError>
Constructs a new Contribution instance from an HTML element.
Provided element reference corresponds to scraped Github heatmap
node.
§Errors
HeatmapError::QueryAttributefails to query heat level attributeHeatmapError::ParseAttributefails to parse heat level attribute
Sourcepub fn render(&self, color: &ColorValues) -> String
pub fn render(&self, color: &ColorValues) -> String
Renders a contribution node.
Returns a formatted string containing a Unicode box character,
with a fill color depending on the provided ColorValues variant,
and the heat_level property of the Contribution instance.
Trait Implementations§
Source§impl Clone for Contribution
impl Clone for Contribution
Source§fn clone(&self) -> Contribution
fn clone(&self) -> Contribution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Contribution
impl Debug for Contribution
Source§impl PartialEq for Contribution
impl PartialEq for Contribution
impl Eq for Contribution
impl StructuralPartialEq for Contribution
Auto Trait Implementations§
impl Freeze for Contribution
impl RefUnwindSafe for Contribution
impl Send for Contribution
impl Sync for Contribution
impl Unpin for Contribution
impl UnwindSafe for Contribution
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.