mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test flowy-user with protobuf serde
This commit is contained in:
parent
2d9c7ba48e
commit
0b76f82d97
@ -1,5 +1,5 @@
|
|||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
use std::mem::{forget, size_of};
|
use std::mem::forget;
|
||||||
|
|
||||||
pub fn forget_rust(buf: Vec<u8>) -> *const u8 {
|
pub fn forget_rust(buf: Vec<u8>) -> *const u8 {
|
||||||
let ptr = buf.as_ptr();
|
let ptr = buf.as_ptr();
|
||||||
|
@ -4,7 +4,7 @@ use crate::c::{extend_front_four_bytes_into_bytes, forget_rust};
|
|||||||
use flowy_sdk::*;
|
use flowy_sdk::*;
|
||||||
use flowy_sys::prelude::*;
|
use flowy_sys::prelude::*;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::{cell::RefCell, ffi::CStr, future::Future, os::raw::c_char};
|
use std::{ffi::CStr, future::Future, os::raw::c_char};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref FFI_RUNTIME: tokio::runtime::Runtime =
|
pub static ref FFI_RUNTIME: tokio::runtime::Runtime =
|
||||||
@ -47,9 +47,9 @@ pub extern "C" fn async_command(port: i64, input: *const u8, len: usize) {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn sync_command(input: *const u8, len: usize) -> *const u8 {
|
pub extern "C" fn sync_command(input: *const u8, len: usize) -> *const u8 {
|
||||||
let mut request: DispatchRequest = FFIRequest::from_u8_pointer(input, len).into();
|
let request: DispatchRequest = FFIRequest::from_u8_pointer(input, len).into();
|
||||||
log::trace!("[FFI]: {} Sync Event: {:?}", &request.id, &request.event,);
|
log::trace!("[FFI]: {} Sync Event: {:?}", &request.id, &request.event,);
|
||||||
let response = EventDispatch::sync_send(request);
|
let _response = EventDispatch::sync_send(request);
|
||||||
|
|
||||||
// FFIResponse { }
|
// FFIResponse { }
|
||||||
let response_bytes = vec![];
|
let response_bytes = vec![];
|
||||||
@ -89,7 +89,7 @@ where
|
|||||||
{
|
{
|
||||||
let isolate = allo_isolate::Isolate::new(port);
|
let isolate = allo_isolate::Isolate::new(port);
|
||||||
match isolate.catch_unwind(future).await {
|
match isolate.catch_unwind(future).await {
|
||||||
Ok(success) => {
|
Ok(_success) => {
|
||||||
log::trace!("[FFI]: Post data to dart success");
|
log::trace!("[FFI]: Post data to dart success");
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -109,7 +109,7 @@ impl std::convert::From<FFIRequest> for DispatchRequest {
|
|||||||
} else {
|
} else {
|
||||||
Payload::None
|
Payload::None
|
||||||
};
|
};
|
||||||
let mut request = DispatchRequest::new(ffi_request.event, payload);
|
let request = DispatchRequest::new(ffi_request.event, payload);
|
||||||
request
|
request
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ pub fn parse_ty<'a>(ctxt: &Ctxt, ty: &'a syn::Type) -> Option<TyInfo<'a>> {
|
|||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_option = seg.ident == "Option";
|
let _is_option = seg.ident == "Option";
|
||||||
|
|
||||||
return if let syn::PathArguments::AngleBracketed(ref bracketed) = seg.arguments {
|
return if let syn::PathArguments::AngleBracketed(ref bracketed) = seg.arguments {
|
||||||
match seg.ident.to_string().as_ref() {
|
match seg.ident.to_string().as_ref() {
|
||||||
|
@ -16,7 +16,12 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
|
|||||||
"u8" => TypeCategory::Bytes,
|
"u8" => TypeCategory::Bytes,
|
||||||
"String" => TypeCategory::Str,
|
"String" => TypeCategory::Str,
|
||||||
"User"
|
"User"
|
||||||
| "UserCheck"
|
| "UserSignUpParams"
|
||||||
|
| "UserSignUpRequest"
|
||||||
|
| "UserSignUpResult"
|
||||||
|
| "UserSignInParams"
|
||||||
|
| "UserSignInRequest"
|
||||||
|
| "UserSignInResult"
|
||||||
=> TypeCategory::Protobuf,
|
=> TypeCategory::Protobuf,
|
||||||
|
|
||||||
"Option" => TypeCategory::Opt,
|
"Option" => TypeCategory::Opt,
|
||||||
|
@ -5,7 +5,7 @@ use proc_macro2::TokenStream;
|
|||||||
pub fn make_enum_token_stream(_ctxt: &Ctxt, cont: &ASTContainer) -> Option<TokenStream> {
|
pub fn make_enum_token_stream(_ctxt: &Ctxt, cont: &ASTContainer) -> Option<TokenStream> {
|
||||||
let enum_ident = &cont.ident;
|
let enum_ident = &cont.ident;
|
||||||
let pb_enum = cont.attrs.pb_enum_type()?;
|
let pb_enum = cont.attrs.pb_enum_type()?;
|
||||||
let build_to_pb_enum = cont.data.all_idents().map(|i| {
|
let _build_to_pb_enum = cont.data.all_idents().map(|i| {
|
||||||
let token_stream: TokenStream = quote! {
|
let token_stream: TokenStream = quote! {
|
||||||
#enum_ident::#i => #pb_enum::#i,
|
#enum_ident::#i => #pb_enum::#i,
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ pub fn make_se_token_stream(ctxt: &Ctxt, ast: &ASTContainer) -> Option<TokenStre
|
|||||||
.filter(|f| !f.attrs.skip_serializing())
|
.filter(|f| !f.attrs.skip_serializing())
|
||||||
.flat_map(|field| se_token_stream_for_field(&ctxt, &field, false));
|
.flat_map(|field| se_token_stream_for_field(&ctxt, &field, false));
|
||||||
|
|
||||||
let build_set_fields = ast
|
let _build_set_fields = ast
|
||||||
.data
|
.data
|
||||||
.all_fields()
|
.all_fields()
|
||||||
.filter(|f| !f.attrs.skip_serializing())
|
.filter(|f| !f.attrs.skip_serializing())
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use tracing::{subscriber::set_global_default, Level};
|
use tracing::subscriber::set_global_default;
|
||||||
use tracing_appender::rolling::RollingFileAppender;
|
|
||||||
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
|
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
|
||||||
use tracing_log::LogTracer;
|
use tracing_log::LogTracer;
|
||||||
use tracing_subscriber::{
|
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
|
||||||
layer::{Layered, SubscriberExt},
|
|
||||||
EnvFilter,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub struct FlowyLogBuilder {
|
pub struct FlowyLogBuilder {
|
||||||
name: String,
|
name: String,
|
||||||
@ -34,7 +31,7 @@ impl FlowyLogBuilder {
|
|||||||
pub fn build(self) -> std::result::Result<(), String> {
|
pub fn build(self) -> std::result::Result<(), String> {
|
||||||
let env_filter = EnvFilter::new(self.env_filter);
|
let env_filter = EnvFilter::new(self.env_filter);
|
||||||
|
|
||||||
let mut subscriber = tracing_subscriber::fmt()
|
let subscriber = tracing_subscriber::fmt()
|
||||||
.with_target(false)
|
.with_target(false)
|
||||||
.with_max_level(tracing::Level::TRACE)
|
.with_max_level(tracing::Level::TRACE)
|
||||||
.with_writer(std::io::stderr)
|
.with_writer(std::io::stderr)
|
||||||
@ -51,7 +48,7 @@ impl FlowyLogBuilder {
|
|||||||
let local_file_name = format!("{}.log", &self.name);
|
let local_file_name = format!("{}.log", &self.name);
|
||||||
let file_appender =
|
let file_appender =
|
||||||
tracing_appender::rolling::daily(self.directory.clone(), local_file_name);
|
tracing_appender::rolling::daily(self.directory.clone(), local_file_name);
|
||||||
let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender);
|
let (_non_blocking, _guard) = tracing_appender::non_blocking(file_appender);
|
||||||
|
|
||||||
let _ = set_global_default(subscriber.with(JsonStorageLayer).with(formatting_layer))
|
let _ = set_global_default(subscriber.with(JsonStorageLayer).with(formatting_layer))
|
||||||
.map_err(|e| format!("{:?}", e))?;
|
.map_err(|e| format!("{:?}", e))?;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use flowy_sdk::module::build_modules;
|
|
||||||
pub use flowy_sdk::*;
|
pub use flowy_sdk::*;
|
||||||
use flowy_sys::prelude::*;
|
use flowy_sys::prelude::*;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
mod helper;
|
mod helper;
|
||||||
mod user_check;
|
mod user;
|
||||||
|
1
rust-lib/flowy-sdk/tests/sdk/user/mod.rs
Normal file
1
rust-lib/flowy-sdk/tests/sdk/user/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
mod sign_in;
|
23
rust-lib/flowy-sdk/tests/sdk/user/sign_in.rs
Normal file
23
rust-lib/flowy-sdk/tests/sdk/user/sign_in.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
use crate::helper::*;
|
||||||
|
use flowy_sys::prelude::*;
|
||||||
|
use flowy_user::prelude::*;
|
||||||
|
use std::convert::{TryFrom, TryInto};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn sign_in_without_password() {
|
||||||
|
let params = UserSignInParams {
|
||||||
|
email: "appflowy@gmail.com".to_string(),
|
||||||
|
password: "".to_string(),
|
||||||
|
};
|
||||||
|
let bytes: Vec<u8> = params.try_into().unwrap();
|
||||||
|
let resp = EventTester::new(SignIn, Payload::Bytes(bytes)).sync_send();
|
||||||
|
match resp.payload {
|
||||||
|
Payload::None => {},
|
||||||
|
Payload::Bytes(bytes) => {
|
||||||
|
let result = UserSignInResult::try_from(&bytes).unwrap();
|
||||||
|
dbg!(&result);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_eq!(resp.status_code, StatusCode::Ok);
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
use super::helper::*;
|
|
||||||
use flowy_sys::prelude::*;
|
|
||||||
use flowy_user::prelude::*;
|
|
||||||
use tokio::time::{sleep, Duration};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[should_panic]
|
|
||||||
fn auth_check_no_payload() {
|
|
||||||
let resp = EventTester::new(AuthCheck, Payload::None).sync_send();
|
|
||||||
assert_eq!(resp.status_code, StatusCode::Ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn auth_check_with_user_name_email_payload() {
|
|
||||||
// let user_data = UserData::new("jack".to_owned(),
|
|
||||||
// "helloworld@gmail.com".to_owned());
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// EventTester::new(AuthCheck)
|
|
||||||
// .bytes_payload(user_data)
|
|
||||||
// .sync_send();
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
use flowy_sys::prelude::*;
|
use flowy_sys::prelude::*;
|
||||||
use std::{cell::RefCell, sync::Once};
|
use std::sync::Once;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn setup_env() {
|
pub fn setup_env() {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
mod user;
|
pub mod user;
|
||||||
mod user_email;
|
|
||||||
mod user_name;
|
|
||||||
|
|
||||||
pub use user::*;
|
pub use user::*;
|
||||||
pub use user_email::*;
|
|
||||||
pub use user_name::*;
|
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
use crate::domain::{user_email::UserEmail, user_name::UserName};
|
|
||||||
use flowy_derive::ProtoBuf;
|
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[derive(ProtoBuf, Default)]
|
|
||||||
pub struct User {
|
|
||||||
#[pb(index = 1)]
|
|
||||||
name: String,
|
|
||||||
|
|
||||||
#[pb(index = 2)]
|
|
||||||
email: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl User {
|
|
||||||
pub fn new(name: UserName, email: UserEmail) -> Self {
|
|
||||||
Self {
|
|
||||||
name: name.0,
|
|
||||||
email: email.0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// #[derive(serde::Serialize)]
|
|
||||||
// pub struct UserStatus {
|
|
||||||
// is_login: bool,
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// impl FromBytes for UserData {
|
|
||||||
// fn parse_from_bytes(_bytes: &Vec<u8>) -> Result<UserData, SystemError> {
|
|
||||||
// unimplemented!() } }
|
|
||||||
//
|
|
||||||
// impl ToBytes for UserStatus {
|
|
||||||
// fn into_bytes(self) -> Result<Vec<u8>, SystemError> { unimplemented!() }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(Debug, ProtoBuf, Default)]
|
|
||||||
pub struct UserCheck {
|
|
||||||
#[pb(index = 1)]
|
|
||||||
pub name: String,
|
|
||||||
|
|
||||||
#[pb(index = 2)]
|
|
||||||
pub email: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UserCheck {
|
|
||||||
pub fn new(name: String, email: String) -> Self { Self { name, email } }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryInto<User> for UserCheck {
|
|
||||||
type Error = String;
|
|
||||||
|
|
||||||
fn try_into(self) -> Result<User, Self::Error> {
|
|
||||||
let name = UserName::parse(self.name)?;
|
|
||||||
let email = UserEmail::parse(self.email)?;
|
|
||||||
Ok(User::new(name, email))
|
|
||||||
}
|
|
||||||
}
|
|
13
rust-lib/flowy-user/src/domain/user/mod.rs
Normal file
13
rust-lib/flowy-user/src/domain/user/mod.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
mod sign_in;
|
||||||
|
mod sign_up;
|
||||||
|
mod user;
|
||||||
|
mod user_email;
|
||||||
|
mod user_name;
|
||||||
|
mod user_password;
|
||||||
|
|
||||||
|
pub use sign_in::*;
|
||||||
|
pub use sign_up::*;
|
||||||
|
pub use user::*;
|
||||||
|
pub use user_email::*;
|
||||||
|
pub use user_name::*;
|
||||||
|
pub use user_password::*;
|
45
rust-lib/flowy-user/src/domain/user/sign_in.rs
Normal file
45
rust-lib/flowy-user/src/domain/user/sign_in.rs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
use crate::domain::{UserEmail, UserPassword};
|
||||||
|
use flowy_derive::ProtoBuf;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default)]
|
||||||
|
pub struct UserSignInParams {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub email: String,
|
||||||
|
|
||||||
|
#[pb(index = 2)]
|
||||||
|
pub password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, ProtoBuf)]
|
||||||
|
pub struct UserSignInRequest {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub email: String,
|
||||||
|
|
||||||
|
#[pb(index = 2)]
|
||||||
|
pub password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryInto<UserSignInRequest> for UserSignInParams {
|
||||||
|
type Error = String;
|
||||||
|
|
||||||
|
fn try_into(self) -> Result<UserSignInRequest, Self::Error> {
|
||||||
|
let email = UserEmail::parse(self.email)?;
|
||||||
|
let password = UserPassword::parse(self.password)?;
|
||||||
|
|
||||||
|
Ok(UserSignInRequest {
|
||||||
|
email: email.0,
|
||||||
|
password: password.0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default, Debug)]
|
||||||
|
pub struct UserSignInResult {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub is_success: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignInResult {
|
||||||
|
pub fn new(is_success: bool) -> Self { Self { is_success } }
|
||||||
|
}
|
51
rust-lib/flowy-user/src/domain/user/sign_up.rs
Normal file
51
rust-lib/flowy-user/src/domain/user/sign_up.rs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
use crate::domain::{UserEmail, UserName, UserPassword};
|
||||||
|
use flowy_derive::ProtoBuf;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default)]
|
||||||
|
pub struct UserSignUpParams {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub email: String,
|
||||||
|
|
||||||
|
#[pb(index = 2)]
|
||||||
|
pub name: String,
|
||||||
|
|
||||||
|
#[pb(index = 3)]
|
||||||
|
pub password: String,
|
||||||
|
}
|
||||||
|
impl TryInto<UserSignUpRequest> for UserSignUpParams {
|
||||||
|
type Error = String;
|
||||||
|
|
||||||
|
fn try_into(self) -> Result<UserSignUpRequest, Self::Error> {
|
||||||
|
let email = UserEmail::parse(self.email)?;
|
||||||
|
let name = UserName::parse(self.name)?;
|
||||||
|
let password = UserPassword::parse(self.password)?;
|
||||||
|
Ok(UserSignUpRequest {
|
||||||
|
email: email.0,
|
||||||
|
name: name.0,
|
||||||
|
password: password.0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default)]
|
||||||
|
pub struct UserSignUpRequest {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub email: String,
|
||||||
|
|
||||||
|
#[pb(index = 2)]
|
||||||
|
pub name: String,
|
||||||
|
|
||||||
|
#[pb(index = 3)]
|
||||||
|
pub password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default)]
|
||||||
|
pub struct UserSignUpResult {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
pub is_success: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignUpResult {
|
||||||
|
pub fn new(is_success: bool) -> Self { Self { is_success } }
|
||||||
|
}
|
25
rust-lib/flowy-user/src/domain/user/user.rs
Normal file
25
rust-lib/flowy-user/src/domain/user/user.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use crate::domain::{UserEmail, UserName, UserPassword};
|
||||||
|
use flowy_derive::ProtoBuf;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[derive(ProtoBuf, Default)]
|
||||||
|
pub struct User {
|
||||||
|
#[pb(index = 1)]
|
||||||
|
name: String,
|
||||||
|
|
||||||
|
#[pb(index = 2)]
|
||||||
|
email: String,
|
||||||
|
|
||||||
|
#[pb(index = 3)]
|
||||||
|
password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl User {
|
||||||
|
pub fn new(name: UserName, email: UserEmail, password: UserPassword) -> Self {
|
||||||
|
Self {
|
||||||
|
name: name.0,
|
||||||
|
email: email.0,
|
||||||
|
password: password.0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
rust-lib/flowy-user/src/domain/user/user_password.rs
Normal file
6
rust-lib/flowy-user/src/domain/user/user_password.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#[derive(Debug)]
|
||||||
|
pub struct UserPassword(pub String);
|
||||||
|
|
||||||
|
impl UserPassword {
|
||||||
|
pub fn parse(s: String) -> Result<UserPassword, String> { Ok(Self(s)) }
|
||||||
|
}
|
@ -1,18 +1,36 @@
|
|||||||
use crate::domain::{User, UserCheck, UserEmail, UserName};
|
use crate::domain::user::*;
|
||||||
use flowy_sys::prelude::*;
|
use flowy_sys::prelude::*;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
||||||
#[tracing::instrument(
|
#[tracing::instrument(
|
||||||
name = "User check",
|
name = "user_sign_in",
|
||||||
skip(data),
|
skip(data),
|
||||||
fields(
|
fields(
|
||||||
email = %data.email,
|
email = %data.email,
|
||||||
name = %data.name
|
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
pub async fn user_check(data: Data<UserCheck>) -> ResponseResult<User, String> {
|
pub async fn user_sign_in(
|
||||||
let user: User = data.into_inner().try_into().unwrap();
|
data: Data<UserSignInParams>,
|
||||||
|
) -> ResponseResult<UserSignInResult, String> {
|
||||||
|
let _request: UserSignInRequest = data.into_inner().try_into()?;
|
||||||
|
|
||||||
response_ok(user)
|
let response = UserSignInResult::new(true);
|
||||||
|
response_ok(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(
|
||||||
|
name = "user_sign_up",
|
||||||
|
skip(data),
|
||||||
|
fields(
|
||||||
|
email = %data.email,
|
||||||
|
)
|
||||||
|
)]
|
||||||
|
pub async fn user_sign_up(
|
||||||
|
data: Data<UserSignUpParams>,
|
||||||
|
) -> ResponseResult<UserSignUpResult, String> {
|
||||||
|
let _request: UserSignUpRequest = data.into_inner().try_into()?;
|
||||||
|
|
||||||
|
let response = UserSignUpResult::new(true);
|
||||||
|
response_ok(response)
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ use flowy_sys::prelude::*;
|
|||||||
pub fn create() -> Module {
|
pub fn create() -> Module {
|
||||||
Module::new()
|
Module::new()
|
||||||
.name("Flowy-User")
|
.name("Flowy-User")
|
||||||
.event(AuthCheck, user_check)
|
.event(SignIn, user_sign_in)
|
||||||
.event(SignIn, user_check)
|
.event(SignUp, user_sign_up)
|
||||||
.event(SignUp, user_check)
|
|
||||||
.event(SignOut, user_check)
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
|
||||||
|
mod sign_up;
|
||||||
|
pub use sign_up::*;
|
||||||
|
|
||||||
|
mod sign_in;
|
||||||
|
pub use sign_in::*;
|
||||||
|
|
||||||
mod user;
|
mod user;
|
||||||
pub use user::*;
|
pub use user::*;
|
||||||
|
616
rust-lib/flowy-user/src/protobuf/model/sign_in.rs
Normal file
616
rust-lib/flowy-user/src/protobuf/model/sign_in.rs
Normal file
@ -0,0 +1,616 @@
|
|||||||
|
// This file is generated by rust-protobuf 2.22.1. Do not edit
|
||||||
|
// @generated
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/rust-clippy/issues/702
|
||||||
|
#![allow(unknown_lints)]
|
||||||
|
#![allow(clippy::all)]
|
||||||
|
|
||||||
|
#![allow(unused_attributes)]
|
||||||
|
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||||
|
|
||||||
|
#![allow(box_pointers)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
#![allow(non_camel_case_types)]
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
#![allow(non_upper_case_globals)]
|
||||||
|
#![allow(trivial_casts)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
#![allow(unused_results)]
|
||||||
|
//! Generated file from `sign_in.proto`
|
||||||
|
|
||||||
|
/// Generated files are compatible only with the same version
|
||||||
|
/// of protobuf runtime.
|
||||||
|
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignInParams {
|
||||||
|
// message fields
|
||||||
|
pub email: ::std::string::String,
|
||||||
|
pub password: ::std::string::String,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignInParams {
|
||||||
|
fn default() -> &'a UserSignInParams {
|
||||||
|
<UserSignInParams as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignInParams {
|
||||||
|
pub fn new() -> UserSignInParams {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// string email = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_email(&self) -> &str {
|
||||||
|
&self.email
|
||||||
|
}
|
||||||
|
pub fn clear_email(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_email(&mut self, v: ::std::string::String) {
|
||||||
|
self.email = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_email(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.email
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_email(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string password = 2;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_password(&self) -> &str {
|
||||||
|
&self.password
|
||||||
|
}
|
||||||
|
pub fn clear_password(&mut self) {
|
||||||
|
self.password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_password(&mut self, v: ::std::string::String) {
|
||||||
|
self.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_password(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_password(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.password, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignInParams {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(1, &self.email);
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(2, &self.password);
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
os.write_string(1, &self.email)?;
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
os.write_string(2, &self.password)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignInParams {
|
||||||
|
UserSignInParams::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"email",
|
||||||
|
|m: &UserSignInParams| { &m.email },
|
||||||
|
|m: &mut UserSignInParams| { &mut m.email },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"password",
|
||||||
|
|m: &UserSignInParams| { &m.password },
|
||||||
|
|m: &mut UserSignInParams| { &mut m.password },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignInParams>(
|
||||||
|
"UserSignInParams",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignInParams {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignInParams> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignInParams::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignInParams {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
self.password.clear();
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignInParams {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignInParams {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignInRequest {
|
||||||
|
// message fields
|
||||||
|
pub email: ::std::string::String,
|
||||||
|
pub password: ::std::string::String,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignInRequest {
|
||||||
|
fn default() -> &'a UserSignInRequest {
|
||||||
|
<UserSignInRequest as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignInRequest {
|
||||||
|
pub fn new() -> UserSignInRequest {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// string email = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_email(&self) -> &str {
|
||||||
|
&self.email
|
||||||
|
}
|
||||||
|
pub fn clear_email(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_email(&mut self, v: ::std::string::String) {
|
||||||
|
self.email = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_email(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.email
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_email(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string password = 2;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_password(&self) -> &str {
|
||||||
|
&self.password
|
||||||
|
}
|
||||||
|
pub fn clear_password(&mut self) {
|
||||||
|
self.password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_password(&mut self, v: ::std::string::String) {
|
||||||
|
self.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_password(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_password(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.password, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignInRequest {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(1, &self.email);
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(2, &self.password);
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
os.write_string(1, &self.email)?;
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
os.write_string(2, &self.password)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignInRequest {
|
||||||
|
UserSignInRequest::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"email",
|
||||||
|
|m: &UserSignInRequest| { &m.email },
|
||||||
|
|m: &mut UserSignInRequest| { &mut m.email },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"password",
|
||||||
|
|m: &UserSignInRequest| { &m.password },
|
||||||
|
|m: &mut UserSignInRequest| { &mut m.password },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignInRequest>(
|
||||||
|
"UserSignInRequest",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignInRequest {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignInRequest> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignInRequest::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignInRequest {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
self.password.clear();
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignInRequest {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignInRequest {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignInResult {
|
||||||
|
// message fields
|
||||||
|
pub is_success: bool,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignInResult {
|
||||||
|
fn default() -> &'a UserSignInResult {
|
||||||
|
<UserSignInResult as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignInResult {
|
||||||
|
pub fn new() -> UserSignInResult {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool is_success = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_is_success(&self) -> bool {
|
||||||
|
self.is_success
|
||||||
|
}
|
||||||
|
pub fn clear_is_success(&mut self) {
|
||||||
|
self.is_success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_is_success(&mut self, v: bool) {
|
||||||
|
self.is_success = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignInResult {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
if wire_type != ::protobuf::wire_format::WireTypeVarint {
|
||||||
|
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
|
||||||
|
}
|
||||||
|
let tmp = is.read_bool()?;
|
||||||
|
self.is_success = tmp;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if self.is_success != false {
|
||||||
|
my_size += 2;
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if self.is_success != false {
|
||||||
|
os.write_bool(1, self.is_success)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignInResult {
|
||||||
|
UserSignInResult::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
|
||||||
|
"is_success",
|
||||||
|
|m: &UserSignInResult| { &m.is_success },
|
||||||
|
|m: &mut UserSignInResult| { &mut m.is_success },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignInResult>(
|
||||||
|
"UserSignInResult",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignInResult {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignInResult> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignInResult::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignInResult {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.is_success = false;
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignInResult {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignInResult {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
|
\n\rsign_in.proto\"D\n\x10UserSignInParams\x12\x14\n\x05email\x18\x01\
|
||||||
|
\x20\x01(\tR\x05email\x12\x1a\n\x08password\x18\x02\x20\x01(\tR\x08passw\
|
||||||
|
ord\"E\n\x11UserSignInRequest\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05\
|
||||||
|
email\x12\x1a\n\x08password\x18\x02\x20\x01(\tR\x08password\"1\n\x10User\
|
||||||
|
SignInResult\x12\x1d\n\nis_success\x18\x01\x20\x01(\x08R\tisSuccessJ\xed\
|
||||||
|
\x02\n\x06\x12\x04\0\0\x0c\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\
|
||||||
|
\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x18\n\
|
||||||
|
\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x15\n\x0c\n\x05\x04\0\x02\0\x05\
|
||||||
|
\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x10\n\x0c\
|
||||||
|
\n\x05\x04\0\x02\0\x03\x12\x03\x03\x13\x14\n\x0b\n\x04\x04\0\x02\x01\x12\
|
||||||
|
\x03\x04\x04\x18\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\x04\n\n\x0c\n\
|
||||||
|
\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x13\n\x0c\n\x05\x04\0\x02\x01\x03\
|
||||||
|
\x12\x03\x04\x16\x17\n\n\n\x02\x04\x01\x12\x04\x06\0\t\x01\n\n\n\x03\x04\
|
||||||
|
\x01\x01\x12\x03\x06\x08\x19\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x07\x04\
|
||||||
|
\x15\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x07\x04\n\n\x0c\n\x05\x04\x01\
|
||||||
|
\x02\0\x01\x12\x03\x07\x0b\x10\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x07\
|
||||||
|
\x13\x14\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x08\x04\x18\n\x0c\n\x05\x04\
|
||||||
|
\x01\x02\x01\x05\x12\x03\x08\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\
|
||||||
|
\x03\x08\x0b\x13\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x08\x16\x17\n\n\
|
||||||
|
\n\x02\x04\x02\x12\x04\n\0\x0c\x01\n\n\n\x03\x04\x02\x01\x12\x03\n\x08\
|
||||||
|
\x18\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x0b\x04\x18\n\x0c\n\x05\x04\x02\
|
||||||
|
\x02\0\x05\x12\x03\x0b\x04\x08\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x0b\
|
||||||
|
\t\x13\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x0b\x16\x17b\x06proto3\
|
||||||
|
";
|
||||||
|
|
||||||
|
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
|
||||||
|
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||||
|
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||||
|
file_descriptor_proto_lazy.get(|| {
|
||||||
|
parse_descriptor_proto()
|
||||||
|
})
|
||||||
|
}
|
707
rust-lib/flowy-user/src/protobuf/model/sign_up.rs
Normal file
707
rust-lib/flowy-user/src/protobuf/model/sign_up.rs
Normal file
@ -0,0 +1,707 @@
|
|||||||
|
// This file is generated by rust-protobuf 2.22.1. Do not edit
|
||||||
|
// @generated
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/rust-clippy/issues/702
|
||||||
|
#![allow(unknown_lints)]
|
||||||
|
#![allow(clippy::all)]
|
||||||
|
|
||||||
|
#![allow(unused_attributes)]
|
||||||
|
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||||
|
|
||||||
|
#![allow(box_pointers)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
#![allow(non_camel_case_types)]
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
#![allow(non_upper_case_globals)]
|
||||||
|
#![allow(trivial_casts)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
#![allow(unused_results)]
|
||||||
|
//! Generated file from `sign_up.proto`
|
||||||
|
|
||||||
|
/// Generated files are compatible only with the same version
|
||||||
|
/// of protobuf runtime.
|
||||||
|
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignUpParams {
|
||||||
|
// message fields
|
||||||
|
pub email: ::std::string::String,
|
||||||
|
pub name: ::std::string::String,
|
||||||
|
pub password: ::std::string::String,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignUpParams {
|
||||||
|
fn default() -> &'a UserSignUpParams {
|
||||||
|
<UserSignUpParams as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignUpParams {
|
||||||
|
pub fn new() -> UserSignUpParams {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// string email = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_email(&self) -> &str {
|
||||||
|
&self.email
|
||||||
|
}
|
||||||
|
pub fn clear_email(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_email(&mut self, v: ::std::string::String) {
|
||||||
|
self.email = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_email(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.email
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_email(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string name = 2;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_name(&self) -> &str {
|
||||||
|
&self.name
|
||||||
|
}
|
||||||
|
pub fn clear_name(&mut self) {
|
||||||
|
self.name.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_name(&mut self, v: ::std::string::String) {
|
||||||
|
self.name = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_name(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_name(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.name, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string password = 3;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_password(&self) -> &str {
|
||||||
|
&self.password
|
||||||
|
}
|
||||||
|
pub fn clear_password(&mut self) {
|
||||||
|
self.password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_password(&mut self, v: ::std::string::String) {
|
||||||
|
self.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_password(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_password(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.password, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignUpParams {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
|
||||||
|
},
|
||||||
|
3 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(1, &self.email);
|
||||||
|
}
|
||||||
|
if !self.name.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(2, &self.name);
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(3, &self.password);
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
os.write_string(1, &self.email)?;
|
||||||
|
}
|
||||||
|
if !self.name.is_empty() {
|
||||||
|
os.write_string(2, &self.name)?;
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
os.write_string(3, &self.password)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignUpParams {
|
||||||
|
UserSignUpParams::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"email",
|
||||||
|
|m: &UserSignUpParams| { &m.email },
|
||||||
|
|m: &mut UserSignUpParams| { &mut m.email },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"name",
|
||||||
|
|m: &UserSignUpParams| { &m.name },
|
||||||
|
|m: &mut UserSignUpParams| { &mut m.name },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"password",
|
||||||
|
|m: &UserSignUpParams| { &m.password },
|
||||||
|
|m: &mut UserSignUpParams| { &mut m.password },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignUpParams>(
|
||||||
|
"UserSignUpParams",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignUpParams {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignUpParams> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignUpParams::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignUpParams {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
self.name.clear();
|
||||||
|
self.password.clear();
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignUpParams {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignUpParams {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignUpRequest {
|
||||||
|
// message fields
|
||||||
|
pub email: ::std::string::String,
|
||||||
|
pub name: ::std::string::String,
|
||||||
|
pub password: ::std::string::String,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignUpRequest {
|
||||||
|
fn default() -> &'a UserSignUpRequest {
|
||||||
|
<UserSignUpRequest as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignUpRequest {
|
||||||
|
pub fn new() -> UserSignUpRequest {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// string email = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_email(&self) -> &str {
|
||||||
|
&self.email
|
||||||
|
}
|
||||||
|
pub fn clear_email(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_email(&mut self, v: ::std::string::String) {
|
||||||
|
self.email = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_email(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.email
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_email(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string name = 2;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_name(&self) -> &str {
|
||||||
|
&self.name
|
||||||
|
}
|
||||||
|
pub fn clear_name(&mut self) {
|
||||||
|
self.name.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_name(&mut self, v: ::std::string::String) {
|
||||||
|
self.name = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_name(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_name(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.name, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
// string password = 3;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_password(&self) -> &str {
|
||||||
|
&self.password
|
||||||
|
}
|
||||||
|
pub fn clear_password(&mut self) {
|
||||||
|
self.password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_password(&mut self, v: ::std::string::String) {
|
||||||
|
self.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_password(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_password(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.password, ::std::string::String::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignUpRequest {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
|
||||||
|
},
|
||||||
|
3 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(1, &self.email);
|
||||||
|
}
|
||||||
|
if !self.name.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(2, &self.name);
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(3, &self.password);
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if !self.email.is_empty() {
|
||||||
|
os.write_string(1, &self.email)?;
|
||||||
|
}
|
||||||
|
if !self.name.is_empty() {
|
||||||
|
os.write_string(2, &self.name)?;
|
||||||
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
os.write_string(3, &self.password)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignUpRequest {
|
||||||
|
UserSignUpRequest::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"email",
|
||||||
|
|m: &UserSignUpRequest| { &m.email },
|
||||||
|
|m: &mut UserSignUpRequest| { &mut m.email },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"name",
|
||||||
|
|m: &UserSignUpRequest| { &m.name },
|
||||||
|
|m: &mut UserSignUpRequest| { &mut m.name },
|
||||||
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"password",
|
||||||
|
|m: &UserSignUpRequest| { &m.password },
|
||||||
|
|m: &mut UserSignUpRequest| { &mut m.password },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignUpRequest>(
|
||||||
|
"UserSignUpRequest",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignUpRequest {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignUpRequest> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignUpRequest::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignUpRequest {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.email.clear();
|
||||||
|
self.name.clear();
|
||||||
|
self.password.clear();
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignUpRequest {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignUpRequest {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq,Clone,Default)]
|
||||||
|
pub struct UserSignUpResult {
|
||||||
|
// message fields
|
||||||
|
pub is_success: bool,
|
||||||
|
// special fields
|
||||||
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ::std::default::Default for &'a UserSignUpResult {
|
||||||
|
fn default() -> &'a UserSignUpResult {
|
||||||
|
<UserSignUpResult as ::protobuf::Message>::default_instance()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserSignUpResult {
|
||||||
|
pub fn new() -> UserSignUpResult {
|
||||||
|
::std::default::Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool is_success = 1;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_is_success(&self) -> bool {
|
||||||
|
self.is_success
|
||||||
|
}
|
||||||
|
pub fn clear_is_success(&mut self) {
|
||||||
|
self.is_success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_is_success(&mut self, v: bool) {
|
||||||
|
self.is_success = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Message for UserSignUpResult {
|
||||||
|
fn is_initialized(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
while !is.eof()? {
|
||||||
|
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||||
|
match field_number {
|
||||||
|
1 => {
|
||||||
|
if wire_type != ::protobuf::wire_format::WireTypeVarint {
|
||||||
|
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
|
||||||
|
}
|
||||||
|
let tmp = is.read_bool()?;
|
||||||
|
self.is_success = tmp;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute sizes of nested messages
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn compute_size(&self) -> u32 {
|
||||||
|
let mut my_size = 0;
|
||||||
|
if self.is_success != false {
|
||||||
|
my_size += 2;
|
||||||
|
}
|
||||||
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
|
self.cached_size.set(my_size);
|
||||||
|
my_size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||||
|
if self.is_success != false {
|
||||||
|
os.write_bool(1, self.is_success)?;
|
||||||
|
}
|
||||||
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
|
::std::result::Result::Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_cached_size(&self) -> u32 {
|
||||||
|
self.cached_size.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||||
|
&self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||||
|
&mut self.unknown_fields
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||||
|
self as &dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||||
|
self as &mut dyn (::std::any::Any)
|
||||||
|
}
|
||||||
|
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
Self::descriptor_static()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> UserSignUpResult {
|
||||||
|
UserSignUpResult::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
descriptor.get(|| {
|
||||||
|
let mut fields = ::std::vec::Vec::new();
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
|
||||||
|
"is_success",
|
||||||
|
|m: &UserSignUpResult| { &m.is_success },
|
||||||
|
|m: &mut UserSignUpResult| { &mut m.is_success },
|
||||||
|
));
|
||||||
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserSignUpResult>(
|
||||||
|
"UserSignUpResult",
|
||||||
|
fields,
|
||||||
|
file_descriptor_proto()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_instance() -> &'static UserSignUpResult {
|
||||||
|
static instance: ::protobuf::rt::LazyV2<UserSignUpResult> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
instance.get(UserSignUpResult::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::Clear for UserSignUpResult {
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.is_success = false;
|
||||||
|
self.unknown_fields.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for UserSignUpResult {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
::protobuf::text_format::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::protobuf::reflect::ProtobufValue for UserSignUpResult {
|
||||||
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
|
\n\rsign_up.proto\"X\n\x10UserSignUpParams\x12\x14\n\x05email\x18\x01\
|
||||||
|
\x20\x01(\tR\x05email\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\
|
||||||
|
\x1a\n\x08password\x18\x03\x20\x01(\tR\x08password\"Y\n\x11UserSignUpReq\
|
||||||
|
uest\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05email\x12\x12\n\x04name\
|
||||||
|
\x18\x02\x20\x01(\tR\x04name\x12\x1a\n\x08password\x18\x03\x20\x01(\tR\
|
||||||
|
\x08password\"1\n\x10UserSignUpResult\x12\x1d\n\nis_success\x18\x01\x20\
|
||||||
|
\x01(\x08R\tisSuccessJ\xdb\x03\n\x06\x12\x04\0\0\x0e\x01\n\x08\n\x01\x0c\
|
||||||
|
\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\
|
||||||
|
\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x15\n\
|
||||||
|
\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\
|
||||||
|
\x12\x03\x03\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x13\x14\n\
|
||||||
|
\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x14\n\x0c\n\x05\x04\0\x02\x01\
|
||||||
|
\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x0f\
|
||||||
|
\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x12\x13\n\x0b\n\x04\x04\0\x02\
|
||||||
|
\x02\x12\x03\x05\x04\x18\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\n\
|
||||||
|
\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x05\x0b\x13\n\x0c\n\x05\x04\0\x02\
|
||||||
|
\x02\x03\x12\x03\x05\x16\x17\n\n\n\x02\x04\x01\x12\x04\x07\0\x0b\x01\n\n\
|
||||||
|
\n\x03\x04\x01\x01\x12\x03\x07\x08\x19\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
|
||||||
|
\x08\x04\x15\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x08\x04\n\n\x0c\n\x05\
|
||||||
|
\x04\x01\x02\0\x01\x12\x03\x08\x0b\x10\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
|
||||||
|
\x03\x08\x13\x14\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\t\x04\x14\n\x0c\n\
|
||||||
|
\x05\x04\x01\x02\x01\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\
|
||||||
|
\x12\x03\t\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\t\x12\x13\n\
|
||||||
|
\x0b\n\x04\x04\x01\x02\x02\x12\x03\n\x04\x18\n\x0c\n\x05\x04\x01\x02\x02\
|
||||||
|
\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\n\x0b\x13\n\
|
||||||
|
\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\n\x16\x17\n\n\n\x02\x04\x02\x12\
|
||||||
|
\x04\x0c\0\x0e\x01\n\n\n\x03\x04\x02\x01\x12\x03\x0c\x08\x18\n\x0b\n\x04\
|
||||||
|
\x04\x02\x02\0\x12\x03\r\x04\x18\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\r\
|
||||||
|
\x04\x08\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\r\t\x13\n\x0c\n\x05\x04\
|
||||||
|
\x02\x02\0\x03\x12\x03\r\x16\x17b\x06proto3\
|
||||||
|
";
|
||||||
|
|
||||||
|
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
|
||||||
|
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||||
|
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||||
|
file_descriptor_proto_lazy.get(|| {
|
||||||
|
parse_descriptor_proto()
|
||||||
|
})
|
||||||
|
}
|
@ -28,6 +28,7 @@ pub struct User {
|
|||||||
// message fields
|
// message fields
|
||||||
pub name: ::std::string::String,
|
pub name: ::std::string::String,
|
||||||
pub email: ::std::string::String,
|
pub email: ::std::string::String,
|
||||||
|
pub password: ::std::string::String,
|
||||||
// special fields
|
// special fields
|
||||||
pub unknown_fields: ::protobuf::UnknownFields,
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
pub cached_size: ::protobuf::CachedSize,
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
@ -95,6 +96,32 @@ impl User {
|
|||||||
pub fn take_email(&mut self) -> ::std::string::String {
|
pub fn take_email(&mut self) -> ::std::string::String {
|
||||||
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// string password = 3;
|
||||||
|
|
||||||
|
|
||||||
|
pub fn get_password(&self) -> &str {
|
||||||
|
&self.password
|
||||||
|
}
|
||||||
|
pub fn clear_password(&mut self) {
|
||||||
|
self.password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_password(&mut self, v: ::std::string::String) {
|
||||||
|
self.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable pointer to the field.
|
||||||
|
// If field is not initialized, it is initialized with default value first.
|
||||||
|
pub fn mut_password(&mut self) -> &mut ::std::string::String {
|
||||||
|
&mut self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take field
|
||||||
|
pub fn take_password(&mut self) -> ::std::string::String {
|
||||||
|
::std::mem::replace(&mut self.password, ::std::string::String::new())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::Message for User {
|
impl ::protobuf::Message for User {
|
||||||
@ -112,6 +139,9 @@ impl ::protobuf::Message for User {
|
|||||||
2 => {
|
2 => {
|
||||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
||||||
},
|
},
|
||||||
|
3 => {
|
||||||
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
|
||||||
|
},
|
||||||
_ => {
|
_ => {
|
||||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
},
|
},
|
||||||
@ -130,6 +160,9 @@ impl ::protobuf::Message for User {
|
|||||||
if !self.email.is_empty() {
|
if !self.email.is_empty() {
|
||||||
my_size += ::protobuf::rt::string_size(2, &self.email);
|
my_size += ::protobuf::rt::string_size(2, &self.email);
|
||||||
}
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
my_size += ::protobuf::rt::string_size(3, &self.password);
|
||||||
|
}
|
||||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
self.cached_size.set(my_size);
|
self.cached_size.set(my_size);
|
||||||
my_size
|
my_size
|
||||||
@ -142,6 +175,9 @@ impl ::protobuf::Message for User {
|
|||||||
if !self.email.is_empty() {
|
if !self.email.is_empty() {
|
||||||
os.write_string(2, &self.email)?;
|
os.write_string(2, &self.email)?;
|
||||||
}
|
}
|
||||||
|
if !self.password.is_empty() {
|
||||||
|
os.write_string(3, &self.password)?;
|
||||||
|
}
|
||||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
::std::result::Result::Ok(())
|
::std::result::Result::Ok(())
|
||||||
}
|
}
|
||||||
@ -190,6 +226,11 @@ impl ::protobuf::Message for User {
|
|||||||
|m: &User| { &m.email },
|
|m: &User| { &m.email },
|
||||||
|m: &mut User| { &mut m.email },
|
|m: &mut User| { &mut m.email },
|
||||||
));
|
));
|
||||||
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
|
"password",
|
||||||
|
|m: &User| { &m.password },
|
||||||
|
|m: &mut User| { &mut m.password },
|
||||||
|
));
|
||||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<User>(
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<User>(
|
||||||
"User",
|
"User",
|
||||||
fields,
|
fields,
|
||||||
@ -208,6 +249,7 @@ impl ::protobuf::Clear for User {
|
|||||||
fn clear(&mut self) {
|
fn clear(&mut self) {
|
||||||
self.name.clear();
|
self.name.clear();
|
||||||
self.email.clear();
|
self.email.clear();
|
||||||
|
self.password.clear();
|
||||||
self.unknown_fields.clear();
|
self.unknown_fields.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,226 +266,20 @@ impl ::protobuf::reflect::ProtobufValue for User {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq,Clone,Default)]
|
|
||||||
pub struct UserCheck {
|
|
||||||
// message fields
|
|
||||||
pub name: ::std::string::String,
|
|
||||||
pub email: ::std::string::String,
|
|
||||||
// special fields
|
|
||||||
pub unknown_fields: ::protobuf::UnknownFields,
|
|
||||||
pub cached_size: ::protobuf::CachedSize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> ::std::default::Default for &'a UserCheck {
|
|
||||||
fn default() -> &'a UserCheck {
|
|
||||||
<UserCheck as ::protobuf::Message>::default_instance()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UserCheck {
|
|
||||||
pub fn new() -> UserCheck {
|
|
||||||
::std::default::Default::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
// string name = 1;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn get_name(&self) -> &str {
|
|
||||||
&self.name
|
|
||||||
}
|
|
||||||
pub fn clear_name(&mut self) {
|
|
||||||
self.name.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is passed by value, moved
|
|
||||||
pub fn set_name(&mut self, v: ::std::string::String) {
|
|
||||||
self.name = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mutable pointer to the field.
|
|
||||||
// If field is not initialized, it is initialized with default value first.
|
|
||||||
pub fn mut_name(&mut self) -> &mut ::std::string::String {
|
|
||||||
&mut self.name
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take field
|
|
||||||
pub fn take_name(&mut self) -> ::std::string::String {
|
|
||||||
::std::mem::replace(&mut self.name, ::std::string::String::new())
|
|
||||||
}
|
|
||||||
|
|
||||||
// string email = 2;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn get_email(&self) -> &str {
|
|
||||||
&self.email
|
|
||||||
}
|
|
||||||
pub fn clear_email(&mut self) {
|
|
||||||
self.email.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is passed by value, moved
|
|
||||||
pub fn set_email(&mut self, v: ::std::string::String) {
|
|
||||||
self.email = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mutable pointer to the field.
|
|
||||||
// If field is not initialized, it is initialized with default value first.
|
|
||||||
pub fn mut_email(&mut self) -> &mut ::std::string::String {
|
|
||||||
&mut self.email
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take field
|
|
||||||
pub fn take_email(&mut self) -> ::std::string::String {
|
|
||||||
::std::mem::replace(&mut self.email, ::std::string::String::new())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ::protobuf::Message for UserCheck {
|
|
||||||
fn is_initialized(&self) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
|
||||||
while !is.eof()? {
|
|
||||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
|
||||||
match field_number {
|
|
||||||
1 => {
|
|
||||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
|
|
||||||
},
|
|
||||||
2 => {
|
|
||||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
::std::result::Result::Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute sizes of nested messages
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
fn compute_size(&self) -> u32 {
|
|
||||||
let mut my_size = 0;
|
|
||||||
if !self.name.is_empty() {
|
|
||||||
my_size += ::protobuf::rt::string_size(1, &self.name);
|
|
||||||
}
|
|
||||||
if !self.email.is_empty() {
|
|
||||||
my_size += ::protobuf::rt::string_size(2, &self.email);
|
|
||||||
}
|
|
||||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
|
||||||
self.cached_size.set(my_size);
|
|
||||||
my_size
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
|
||||||
if !self.name.is_empty() {
|
|
||||||
os.write_string(1, &self.name)?;
|
|
||||||
}
|
|
||||||
if !self.email.is_empty() {
|
|
||||||
os.write_string(2, &self.email)?;
|
|
||||||
}
|
|
||||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
|
||||||
::std::result::Result::Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_cached_size(&self) -> u32 {
|
|
||||||
self.cached_size.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
|
||||||
&self.unknown_fields
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
|
||||||
&mut self.unknown_fields
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_any(&self) -> &dyn (::std::any::Any) {
|
|
||||||
self as &dyn (::std::any::Any)
|
|
||||||
}
|
|
||||||
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
|
||||||
self as &mut dyn (::std::any::Any)
|
|
||||||
}
|
|
||||||
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
|
||||||
Self::descriptor_static()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new() -> UserCheck {
|
|
||||||
UserCheck::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
|
||||||
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
|
||||||
descriptor.get(|| {
|
|
||||||
let mut fields = ::std::vec::Vec::new();
|
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
|
||||||
"name",
|
|
||||||
|m: &UserCheck| { &m.name },
|
|
||||||
|m: &mut UserCheck| { &mut m.name },
|
|
||||||
));
|
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
|
||||||
"email",
|
|
||||||
|m: &UserCheck| { &m.email },
|
|
||||||
|m: &mut UserCheck| { &mut m.email },
|
|
||||||
));
|
|
||||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<UserCheck>(
|
|
||||||
"UserCheck",
|
|
||||||
fields,
|
|
||||||
file_descriptor_proto()
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_instance() -> &'static UserCheck {
|
|
||||||
static instance: ::protobuf::rt::LazyV2<UserCheck> = ::protobuf::rt::LazyV2::INIT;
|
|
||||||
instance.get(UserCheck::new)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ::protobuf::Clear for UserCheck {
|
|
||||||
fn clear(&mut self) {
|
|
||||||
self.name.clear();
|
|
||||||
self.email.clear();
|
|
||||||
self.unknown_fields.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ::std::fmt::Debug for UserCheck {
|
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
|
||||||
::protobuf::text_format::fmt(self, f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ::protobuf::reflect::ProtobufValue for UserCheck {
|
|
||||||
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
|
||||||
::protobuf::reflect::ReflectValueRef::Message(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
\n\nuser.proto\"0\n\x04User\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04nam\
|
\n\nuser.proto\"L\n\x04User\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04nam\
|
||||||
e\x12\x14\n\x05email\x18\x02\x20\x01(\tR\x05email\"5\n\tUserCheck\x12\
|
e\x12\x14\n\x05email\x18\x02\x20\x01(\tR\x05email\x12\x1a\n\x08password\
|
||||||
\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x14\n\x05email\x18\x02\
|
\x18\x03\x20\x01(\tR\x08passwordJ\xcf\x01\n\x06\x12\x04\0\0\x06\x01\n\
|
||||||
\x20\x01(\tR\x05emailJ\x9e\x02\n\x06\x12\x04\0\0\t\x01\n\x08\n\x01\x0c\
|
\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\
|
||||||
\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\
|
\n\x03\x04\0\x01\x12\x03\x02\x08\x0c\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
|
||||||
\x01\x12\x03\x02\x08\x0c\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x14\n\
|
\x04\x14\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\
|
||||||
\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\
|
\x02\0\x01\x12\x03\x03\x0b\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\
|
||||||
\x12\x03\x03\x0b\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x12\x13\n\
|
\x12\x13\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x15\n\x0c\n\x05\x04\0\
|
||||||
\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x15\n\x0c\n\x05\x04\0\x02\x01\
|
\x02\x01\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\
|
||||||
\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x10\
|
\x0b\x10\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x13\x14\n\x0b\n\x04\
|
||||||
\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x13\x14\n\n\n\x02\x04\x01\x12\
|
\x04\0\x02\x02\x12\x03\x05\x04\x18\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\
|
||||||
\x04\x06\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x11\n\x0b\n\x04\
|
\x05\x04\n\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x05\x0b\x13\n\x0c\n\x05\
|
||||||
\x04\x01\x02\0\x12\x03\x07\x04\x14\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\
|
\x04\0\x02\x02\x03\x12\x03\x05\x16\x17b\x06proto3\
|
||||||
\x07\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\x0f\n\x0c\n\x05\
|
|
||||||
\x04\x01\x02\0\x03\x12\x03\x07\x12\x13\n\x0b\n\x04\x04\x01\x02\x01\x12\
|
|
||||||
\x03\x08\x04\x15\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x08\x04\n\n\x0c\
|
|
||||||
\n\x05\x04\x01\x02\x01\x01\x12\x03\x08\x0b\x10\n\x0c\n\x05\x04\x01\x02\
|
|
||||||
\x01\x03\x12\x03\x08\x13\x14b\x06proto3\
|
|
||||||
";
|
";
|
||||||
|
|
||||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
13
rust-lib/flowy-user/src/protobuf/proto/sign_in.proto
Normal file
13
rust-lib/flowy-user/src/protobuf/proto/sign_in.proto
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
message UserSignInParams {
|
||||||
|
string email = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
message UserSignInRequest {
|
||||||
|
string email = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
message UserSignInResult {
|
||||||
|
bool is_success = 1;
|
||||||
|
}
|
15
rust-lib/flowy-user/src/protobuf/proto/sign_up.proto
Normal file
15
rust-lib/flowy-user/src/protobuf/proto/sign_up.proto
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
message UserSignUpParams {
|
||||||
|
string email = 1;
|
||||||
|
string name = 2;
|
||||||
|
string password = 3;
|
||||||
|
}
|
||||||
|
message UserSignUpRequest {
|
||||||
|
string email = 1;
|
||||||
|
string name = 2;
|
||||||
|
string password = 3;
|
||||||
|
}
|
||||||
|
message UserSignUpResult {
|
||||||
|
bool is_success = 1;
|
||||||
|
}
|
@ -3,8 +3,5 @@ syntax = "proto3";
|
|||||||
message User {
|
message User {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string email = 2;
|
string email = 2;
|
||||||
}
|
string password = 3;
|
||||||
message UserCheck {
|
|
||||||
string name = 1;
|
|
||||||
string email = 2;
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use crate::proto::ast::*;
|
use crate::proto::ast::*;
|
||||||
use crate::proto::helper::*;
|
use crate::proto::helper::*;
|
||||||
use crate::{proto::template::*, util::*};
|
use crate::{proto::template::*, util::*};
|
||||||
use flowy_ast::*;
|
|
||||||
use shell::*;
|
|
||||||
use std::{fs::OpenOptions, io::Write};
|
use std::{fs::OpenOptions, io::Write};
|
||||||
use syn::Item;
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
pub struct ProtoGen {
|
pub struct ProtoGen {
|
||||||
|
@ -2,7 +2,7 @@ use crate::proto::helper::{CrateProtoInfo, FileProtoInfo};
|
|||||||
use crate::util::{get_tera, read_file};
|
use crate::util::{get_tera, read_file};
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use tera::{Context, Tera};
|
use tera::Context;
|
||||||
|
|
||||||
pub struct ProtobufDeriveMeta {
|
pub struct ProtobufDeriveMeta {
|
||||||
context: Context,
|
context: Context,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::proto::ast::FlowyEnum;
|
use crate::proto::ast::FlowyEnum;
|
||||||
use crate::util::get_tera;
|
use crate::util::get_tera;
|
||||||
use tera::{Context, Tera};
|
use tera::Context;
|
||||||
|
|
||||||
pub struct EnumTemplate {
|
pub struct EnumTemplate {
|
||||||
context: Context,
|
context: Context,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::util::get_tera;
|
use crate::util::get_tera;
|
||||||
use flowy_ast::*;
|
use flowy_ast::*;
|
||||||
use phf::phf_map;
|
use phf::phf_map;
|
||||||
use tera::{Context, Tera};
|
use tera::Context;
|
||||||
|
|
||||||
// Protobuf data type : https://developers.google.com/protocol-buffers/docs/proto3
|
// Protobuf data type : https://developers.google.com/protocol-buffers/docs/proto3
|
||||||
static RUST_TYPE_MAP: phf::Map<&'static str, &'static str> = phf_map! {
|
static RUST_TYPE_MAP: phf::Map<&'static str, &'static str> = phf_map! {
|
||||||
|
Loading…
Reference in New Issue
Block a user