Struct wicrs_server::channel::Channel [−][src]
Text channel, used to group a manage sets of messages.
Fields
id: ID
ID of the channel.
hub_id: ID
ID of the Hub that the channel belongs to.
name: String
Name of the channel.
created: u128
Date the channel was created in milliseconds since Unix Epoch.
Implementations
impl Channel
[src]
pub fn new(name: String, id: ID, hub_id: ID) -> Self
[src]
Creates a new channel object based on parameters.
pub fn get_folder(&self) -> String
[src]
Get the path of the channel’s data folder, used for storing message files.
pub async fn create_dir(&self) -> Result<()>
[src]
Creates the channel data folder.
pub async fn add_message(&mut self, message: Message) -> Result<()>
[src]
Adds a message to the channel, writes it to the file corresponding to the day the message was sent, one file per day of messages, only created if a message is sent that day.
Errors
This function will return an error in the following situations, but is not limited to just these cases:
- The message file does not exist and could not be created.
- Was unable to write to the message file.
pub async fn get_last_messages(&self, max: usize) -> Vec<Message>
[src]
Gets the last messages sent, max
indicates the maximum number of messages to return.
pub async fn get_messages(
&self,
from: u128,
to: u128,
invert: bool,
max: usize
) -> Vec<Message>
[src]
&self,
from: u128,
to: u128,
invert: bool,
max: usize
) -> Vec<Message>
Gets a set of messages between two times given in milliseconds since Unix Epoch.
Arguments
from
- The earliest send time a message can have to be included.to
- The latest send time a message can have to be included.invert
- If true messages are returned in order of newest to oldest if false, oldest to newest, search is also done in that order.max
- The maximum number of messages to return.
pub async fn on_all_raw_lines<F: FnMut(Lines<'_>)>(&self, action: F)
[src]
Perform an operation on the raw string of all the lines of all the files in the channel’s data directory.
pub async fn find_messages_containing(
&self,
string: String,
case_sensitive: bool
) -> Vec<Message>
[src]
&self,
string: String,
case_sensitive: bool
) -> Vec<Message>
Search for messages that contain a string, if case_sensitive
is true than the search is case_sensitive, case sensitive search is marginally faster.
pub async fn get_message(&self, id: &ID) -> Option<Message>
[src]
Get the first message with the given ID.
pub async fn get_current_file(&mut self) -> String
[src]
Gets the path of the current message file, filename is time in milliseconds from Unix Epoch divided by 86400000
(the number of milliseconds in a day).
Trait Implementations
impl Clone for Channel
[src]
impl Debug for Channel
[src]
impl<'de> Deserialize<'de> for Channel
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Channel> for Channel
[src]
impl Serialize for Channel
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Channel
[src]
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,