exposed more funcs as needed

This commit is contained in:
shockrah 2020-07-05 22:04:30 -07:00
parent ffaf602bef
commit cdc2f0a13a

View File

@ -9,7 +9,7 @@ use mysql_async::prelude::{params, Queryable};
use serde_json::Value; use serde_json::Value;
enum ChannelType { pub enum ChannelType {
Voice, Voice,
Text, Text,
Undefined Undefined
@ -17,14 +17,14 @@ enum ChannelType {
impl ChannelType { impl ChannelType {
// These funcs are mainly here to help translation from mysql // These funcs are mainly here to help translation from mysql
fn from_i32(x: i32) -> ChannelType { pub fn from_i32(x: i32) -> ChannelType {
match x { match x {
1 => ChannelType::Voice, 1 => ChannelType::Voice,
2 => ChannelType::Text, 2 => ChannelType::Text,
_ => ChannelType::Undefined _ => ChannelType::Undefined
} }
} }
fn as_i32(&self) -> i32 { pub fn as_i32(&self) -> i32 {
match self { match self {
ChannelType::Voice => 1, ChannelType::Voice => 1,
ChannelType::Text => 2, ChannelType::Text => 2,
@ -34,7 +34,7 @@ impl ChannelType {
} }
// whole ass function exists because serde_json is a walking pos // whole ass function exists because serde_json is a walking pos
fn from_i64_opt(x: Option<i64>) -> ChannelType { pub fn from_i64_opt(x: Option<i64>) -> ChannelType {
if let Some(i) = x { if let Some(i) = x {
match i { match i {
1 => ChannelType::Voice, 1 => ChannelType::Voice,