pub struct Comment<Meta, S> {
pub meta: Meta,
pub calculation_list: S,
pub notify: Option<String>,
pub status: Status,
pub commands: Commands,
pub max_length: usize,
}Expand description
The primary abstraction. Construct -> Extract -> Calculate -> Get Reply
Uses a generic for Metadata (meta).
Uses three type-states exposed as the aliases CommentConstructed, CommentExtracted, and CommentCalculated.
Fields§
§meta: MetaMetadata (generic)
calculation_list: SData for the current step
notify: Option<String>If Some will prepend a “Hey {string}!” to the reply.
status: Status§commands: Commands§max_length: usizeHow long the reply may at most be
Implementations§
Source§impl<Meta> Comment<Meta, String>
impl<Meta> Comment<Meta, String>
Sourcepub fn new(
comment_text: &str,
meta: Meta,
pre_commands: Commands,
max_length: usize,
) -> Self
pub fn new( comment_text: &str, meta: Meta, pre_commands: Commands, max_length: usize, ) -> Self
Takes a raw comment, finds the factorials and commands, and packages it, also checks if it might have something to calculate.
Sourcepub fn extract(self) -> CommentExtracted<Meta>
pub fn extract(self) -> CommentExtracted<Meta>
Extracts the calculations using parse.
Sourcepub fn new_already_replied(meta: Meta, max_length: usize) -> Self
pub fn new_already_replied(meta: Meta, max_length: usize) -> Self
Constructs an empty comment with Status already_replied_or_rejected set.
Source§impl<Meta> Comment<Meta, Vec<CalculationJob>>
impl<Meta> Comment<Meta, Vec<CalculationJob>>
Sourcepub fn calc(self) -> CommentCalculated<Meta>
pub fn calc(self) -> CommentCalculated<Meta>
Does the calculations using calculation_tasks.
Source§impl<Meta> Comment<Meta, Vec<Calculation>>
impl<Meta> Comment<Meta, Vec<Calculation>>
Sourcepub fn get_reply(&self) -> String
pub fn get_reply(&self) -> String
Does the formatting for the reply using calculation_result.
Trait Implementations§
Source§impl<Meta: Ord, S: Ord> Ord for Comment<Meta, S>
impl<Meta: Ord, S: Ord> Ord for Comment<Meta, S>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Meta: PartialOrd, S: PartialOrd> PartialOrd for Comment<Meta, S>
impl<Meta: PartialOrd, S: PartialOrd> PartialOrd for Comment<Meta, S>
impl<Meta: Eq, S: Eq> Eq for Comment<Meta, S>
impl<Meta, S> StructuralPartialEq for Comment<Meta, S>
Auto Trait Implementations§
impl<Meta, S> Freeze for Comment<Meta, S>
impl<Meta, S> RefUnwindSafe for Comment<Meta, S>where
Meta: RefUnwindSafe,
S: RefUnwindSafe,
impl<Meta, S> Send for Comment<Meta, S>
impl<Meta, S> Sync for Comment<Meta, S>
impl<Meta, S> Unpin for Comment<Meta, S>
impl<Meta, S> UnwindSafe for Comment<Meta, S>where
Meta: UnwindSafe,
S: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.