Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
test flowy-user with protobuf serde
appflowy0b76f82d9770
diff --git a/rust-lib/dart-ffi/src/c.rs b/rust-lib/dart-ffi/src/c.rsindex 431cdcde4c..9492f86f1b 100644--- a/rust-lib/dart-ffi/src/c.rs+++ b/rust-lib/dart-ffi/src/c.rs@@ -1,5 +1,5 @@use byteorder::{BigEndian, ByteOrder};-use std::mem::{forget, size_of};+use std::mem::forget;pub fn forget_rust(buf: Vec<u8>) -> *const u8 {let ptr = buf.as_ptr();diff --git a/rust-lib/dart-ffi/src/lib.rs b/rust-lib/dart-ffi/src/lib.rsindex 5614b1f08a..ad73ff73b5 100644--- a/rust-lib/dart-ffi/src/lib.rs+++ b/rust-lib/dart-ffi/src/lib.rs@@ -4,7 +4,7 @@ use crate::c::{extend_front_four_bytes_into_bytes, forget_rust};use flowy_sdk::*;use flowy_sys::prelude::*;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! {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]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,);- let response = EventDispatch::sync_send(request);+ let _response = EventDispatch::sync_send(request);// FFIResponse { }let response_bytes = vec![];@@ -89,7 +89,7 @@ where{let isolate = allo_isolate::Isolate::new(port);match isolate.catch_unwind(future).await {- Ok(success) => {+ Ok(_success) => {log::trace!("[FFI]: Post data to dart success");},Err(e) => {@@ -109,7 +109,7 @@ impl std::convert::From<FFIRequest> for DispatchRequest {} else {Payload::None};- let mut request = DispatchRequest::new(ffi_request.event, payload);+ let request = DispatchRequest::new(ffi_request.event, payload);request}}diff --git a/rust-lib/flowy-ast/src/ty_ext.rs b/rust-lib/flowy-ast/src/ty_ext.rsindex 2596ff04da..f78ef1addd 100644--- a/rust-lib/flowy-ast/src/ty_ext.rs+++ b/rust-lib/flowy-ast/src/ty_ext.rs@@ -52,7 +52,7 @@ pub fn parse_ty<'a>(ctxt: &Ctxt, ty: &'a syn::Type) -> Option<TyInfo<'a>> {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 {match seg.ident.to_string().as_ref() {diff --git a/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs b/rust-lib/flowy-derive/src/derive_cache/derive_cache.rsindex f152a4abc3..68e6edec37 100644--- a/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs+++ b/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs@@ -16,7 +16,12 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {"u8" => TypeCategory::Bytes,"String" => TypeCategory::Str,"User"- | "UserCheck"+ | "UserSignUpParams"+ | "UserSignUpRequest"+ | "UserSignUpResult"+ | "UserSignInParams"+ | "UserSignInRequest"+ | "UserSignInResult"=> TypeCategory::Protobuf,"Option" => TypeCategory::Opt,diff --git a/rust-lib/flowy-derive/src/proto_buf/enum_serde.rs b/rust-lib/flowy-derive/src/proto_buf/enum_serde.rsindex 67013aa5cf..d09c6d3993 100644--- a/rust-lib/flowy-derive/src/proto_buf/enum_serde.rs+++ b/rust-lib/flowy-derive/src/proto_buf/enum_serde.rs@@ -5,7 +5,7 @@ use proc_macro2::TokenStream;pub fn make_enum_token_stream(_ctxt: &Ctxt, cont: &ASTContainer) -> Option<TokenStream> {let enum_ident = &cont.ident;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! {#enum_ident::#i => #pb_enum::#i,};diff --git a/rust-lib/flowy-derive/src/proto_buf/serialize.rs b/rust-lib/flowy-derive/src/proto_buf/serialize.rsindex 39e6cb32e9..81477d0c7b 100644--- a/rust-lib/flowy-derive/src/proto_buf/serialize.rs+++ b/rust-lib/flowy-derive/src/proto_buf/serialize.rs@@ -12,7 +12,7 @@ pub fn make_se_token_stream(ctxt: &Ctxt, ast: &ASTContainer) -> Option<TokenStre.filter(|f| !f.attrs.skip_serializing()).flat_map(|field| se_token_stream_for_field(&ctxt, &field, false));- let build_set_fields = ast+ let _build_set_fields = ast.data.all_fields().filter(|f| !f.attrs.skip_serializing())diff --git a/rust-lib/flowy-log/src/lib.rs b/rust-lib/flowy-log/src/lib.rsindex 7fff5d8055..a74a90446d 100644--- a/rust-lib/flowy-log/src/lib.rs+++ b/rust-lib/flowy-log/src/lib.rs@@ -1,13 +1,10 @@use log::LevelFilter;use std::path::Path;-use tracing::{subscriber::set_global_default, Level};-use tracing_appender::rolling::RollingFileAppender;+use tracing::subscriber::set_global_default;+use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};use tracing_log::LogTracer;-use tracing_subscriber::{- layer::{Layered, SubscriberExt},- EnvFilter,-};+use tracing_subscriber::{layer::SubscriberExt, EnvFilter};pub struct FlowyLogBuilder {name: String,@@ -34,7 +31,7 @@ impl FlowyLogBuilder {pub fn build(self) -> std::result::Result<(), String> {let env_filter = EnvFilter::new(self.env_filter);- let mut subscriber = tracing_subscriber::fmt()+ let subscriber = tracing_subscriber::fmt().with_target(false).with_max_level(tracing::Level::TRACE).with_writer(std::io::stderr)@@ -51,7 +48,7 @@ impl FlowyLogBuilder {let local_file_name = format!("{}.log", &self.name);let file_appender =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)).map_err(|e| format!("{:?}", e))?;diff --git a/rust-lib/flowy-sdk/tests/sdk/helper.rs b/rust-lib/flowy-sdk/tests/sdk/helper.rsindex b8531a5c5b..f79f5f0e1a 100644--- a/rust-lib/flowy-sdk/tests/sdk/helper.rs+++ b/rust-lib/flowy-sdk/tests/sdk/helper.rs@@ -1,4 +1,3 @@-use flowy_sdk::module::build_modules;pub use flowy_sdk::*;use flowy_sys::prelude::*;use std::{diff --git a/rust-lib/flowy-sdk/tests/sdk/main.rs b/rust-lib/flowy-sdk/tests/sdk/main.rsindex 23e6351d42..d4d0cd0c6c 100644--- a/rust-lib/flowy-sdk/tests/sdk/main.rs+++ b/rust-lib/flowy-sdk/tests/sdk/main.rs@@ -1,2 +1,2 @@mod helper;-mod user_check;+mod user;diff --git a/rust-lib/flowy-sdk/tests/sdk/user/mod.rs b/rust-lib/flowy-sdk/tests/sdk/user/mod.rsnew file mode 100644index 0000000000..4aeca270a6--- /dev/null+++ b/rust-lib/flowy-sdk/tests/sdk/user/mod.rs@@ -0,0 +1 @@+mod sign_in;diff --git a/rust-lib/flowy-sdk/tests/sdk/user/sign_in.rs b/rust-lib/flowy-sdk/tests/sdk/user/sign_in.rsnew file mode 100644index 0000000000..b9dcefdb09--- /dev/null+++ b/rust-lib/flowy-sdk/tests/sdk/user/sign_in.rs@@ -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: "[email protected]".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);+}diff --git a/rust-lib/flowy-sdk/tests/sdk/user_check.rs b/rust-lib/flowy-sdk/tests/sdk/user_check.rsdeleted file mode 100644index 28e33cc672..0000000000--- a/rust-lib/flowy-sdk/tests/sdk/user_check.rs+++ /dev/null@@ -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(),- // "[email protected]".to_owned());- //- //- // EventTester::new(AuthCheck)- // .bytes_payload(user_data)- // .sync_send();-}diff --git a/rust-lib/flowy-sys/tests/api/helper.rs b/rust-lib/flowy-sys/tests/api/helper.rsindex 45ee393232..fd9fb3e79e 100644--- a/rust-lib/flowy-sys/tests/api/helper.rs+++ b/rust-lib/flowy-sys/tests/api/helper.rs@@ -1,5 +1,5 @@use flowy_sys::prelude::*;-use std::{cell::RefCell, sync::Once};+use std::sync::Once;#[allow(dead_code)]pub fn setup_env() {diff --git a/rust-lib/flowy-user/src/domain/mod.rs b/rust-lib/flowy-user/src/domain/mod.rsindex df46cf52fe..3232c86445 100644--- a/rust-lib/flowy-user/src/domain/mod.rs+++ b/rust-lib/flowy-user/src/domain/mod.rs@@ -1,7 +1,3 @@-mod user;-mod user_email;-mod user_name;+pub mod user;pub use user::*;-pub use user_email::*;-pub use user_name::*;diff --git a/rust-lib/flowy-user/src/domain/user.rs b/rust-lib/flowy-user/src/domain/user.rsdeleted file mode 100644index 11ff4f8df8..0000000000--- a/rust-lib/flowy-user/src/domain/user.rs+++ /dev/null@@ -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))- }-}diff --git a/rust-lib/flowy-user/src/domain/user/mod.rs b/rust-lib/flowy-user/src/domain/user/mod.rsnew file mode 100644index 0000000000..6dcd7b2dda--- /dev/null+++ b/rust-lib/flowy-user/src/domain/user/mod.rs@@ -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::*;diff --git a/rust-lib/flowy-user/src/domain/user/sign_in.rs b/rust-lib/flowy-user/src/domain/user/sign_in.rsnew file mode 100644index 0000000000..132a2cab95--- /dev/null+++ b/rust-lib/flowy-user/src/domain/user/sign_in.rs@@ -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 } }+}diff --git a/rust-lib/flowy-user/src/domain/user/sign_up.rs b/rust-lib/flowy-user/src/domain/user/sign_up.rsnew file mode 100644index 0000000000..d661d4e891--- /dev/null+++ b/rust-lib/flowy-user/src/domain/user/sign_up.rs@@ -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 } }+}diff --git a/rust-lib/flowy-user/src/domain/user/user.rs b/rust-lib/flowy-user/src/domain/user/user.rsnew file mode 100644index 0000000000..8198426f94--- /dev/null+++ b/rust-lib/flowy-user/src/domain/user/user.rs@@ -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,+ }+ }+}diff --git a/rust-lib/flowy-user/src/domain/user_email.rs b/rust-lib/flowy-user/src/domain/user/user_email.rssimilarity index 100%rename from rust-lib/flowy-user/src/domain/user_email.rsrename to rust-lib/flowy-user/src/domain/user/user_email.rsdiff --git a/rust-lib/flowy-user/src/domain/user_name.rs b/rust-lib/flowy-user/src/domain/user/user_name.rssimilarity index 100%rename from rust-lib/flowy-user/src/domain/user_name.rsrename to rust-lib/flowy-user/src/domain/user/user_name.rsdiff --git a/rust-lib/flowy-user/src/domain/user/user_password.rs b/rust-lib/flowy-user/src/domain/user/user_password.rsnew file mode 100644index 0000000000..b1d2b6e400--- /dev/null+++ b/rust-lib/flowy-user/src/domain/user/user_password.rs@@ -0,0 +1,6 @@+#[derive(Debug)]+pub struct UserPassword(pub String);++impl UserPassword {+ pub fn parse(s: String) -> Result<UserPassword, String> { Ok(Self(s)) }+}diff --git a/rust-lib/flowy-user/src/handlers/auth.rs b/rust-lib/flowy-user/src/handlers/auth.rsindex 3b5ea7a5b9..b846e439a2 100644--- a/rust-lib/flowy-user/src/handlers/auth.rs+++ b/rust-lib/flowy-user/src/handlers/auth.rs@@ -1,18 +1,36 @@-use crate::domain::{User, UserCheck, UserEmail, UserName};+use crate::domain::user::*;use flowy_sys::prelude::*;use std::convert::TryInto;// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html#[tracing::instrument(- name = "User check",+ name = "user_sign_in",skip(data),fields(email = %data.email,- name = %data.name))]-pub async fn user_check(data: Data<UserCheck>) -> ResponseResult<User, String> {- let user: User = data.into_inner().try_into().unwrap();+pub async fn user_sign_in(+ 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)}diff --git a/rust-lib/flowy-user/src/module.rs b/rust-lib/flowy-user/src/module.rsindex 88bde35186..7eed0568dd 100644--- a/rust-lib/flowy-user/src/module.rs+++ b/rust-lib/flowy-user/src/module.rs@@ -4,8 +4,6 @@ use flowy_sys::prelude::*;pub fn create() -> Module {Module::new().name("Flowy-User")- .event(AuthCheck, user_check)- .event(SignIn, user_check)- .event(SignUp, user_check)- .event(SignOut, user_check)+ .event(SignIn, user_sign_in)+ .event(SignUp, user_sign_up)}diff --git a/rust-lib/flowy-user/src/protobuf/model/mod.rs b/rust-lib/flowy-user/src/protobuf/model/mod.rsindex 887ff36376..656f9545c9 100644--- a/rust-lib/flowy-user/src/protobuf/model/mod.rs+++ b/rust-lib/flowy-user/src/protobuf/model/mod.rs@@ -1,3 +1,9 @@+mod sign_up;+pub use sign_up::*;++mod sign_in;+pub use sign_in::*;+mod user;pub use user::*;diff --git a/rust-lib/flowy-user/src/protobuf/model/sign_in.rs b/rust-lib/flowy-user/src/protobuf/model/sign_in.rsnew file mode 100644index 0000000000..00a9b956d1--- /dev/null+++ b/rust-lib/flowy-user/src/protobuf/model/sign_in.rs@@ -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()+ })+}diff --git a/rust-lib/flowy-user/src/protobuf/model/sign_up.rs b/rust-lib/flowy-user/src/protobuf/model/sign_up.rsnew file mode 100644index 0000000000..3c410314df--- /dev/null+++ b/rust-lib/flowy-user/src/protobuf/model/sign_up.rs@@ -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()+ })+}diff --git a/rust-lib/flowy-user/src/protobuf/model/user.rs b/rust-lib/flowy-user/src/protobuf/model/user.rsindex cb99272032..6a25acecf3 100644--- a/rust-lib/flowy-user/src/protobuf/model/user.rs+++ b/rust-lib/flowy-user/src/protobuf/model/user.rs@@ -28,6 +28,7 @@ pub struct User {// message fieldspub name: ::std::string::String,pub email: ::std::string::String,+ pub password: ::std::string::String,// special fieldspub unknown_fields: ::protobuf::UnknownFields,pub cached_size: ::protobuf::CachedSize,@@ -95,210 +96,35 @@ impl User {pub fn take_email(&mut self) -> ::std::string::String {::std::mem::replace(&mut self.email, ::std::string::String::new())}-}--impl ::protobuf::Message for User {- 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() -> User {- User::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: &User| { &m.name },- |m: &mut User| { &mut m.name },- ));- fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(- "email",- |m: &User| { &m.email },- |m: &mut User| { &mut m.email },- ));- ::protobuf::reflect::MessageDescriptor::new_pb_name::<User>(- "User",- fields,- file_descriptor_proto()- )- })- }-- fn default_instance() -> &'static User {- static instance: ::protobuf::rt::LazyV2<User> = ::protobuf::rt::LazyV2::INIT;- instance.get(User::new)- }-}--impl ::protobuf::Clear for User {- fn clear(&mut self) {- self.name.clear();- self.email.clear();- self.unknown_fields.clear();- }-}--impl ::std::fmt::Debug for User {- fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {- ::protobuf::text_format::fmt(self, f)- }-}--impl ::protobuf::reflect::ProtobufValue for User {- fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {- ::protobuf::reflect::ReflectValueRef::Message(self)- }-}--#[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;- }+ // string password = 3;- // 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 get_password(&self) -> &str {+ &self.password}- pub fn clear_email(&mut self) {- self.email.clear();+ pub fn clear_password(&mut self) {+ self.password.clear();}// Param is passed by value, moved- pub fn set_email(&mut self, v: ::std::string::String) {- self.email = v;+ 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_email(&mut self) -> &mut ::std::string::String {- &mut self.email+ pub fn mut_password(&mut self) -> &mut ::std::string::String {+ &mut self.password}// Take field- pub fn take_email(&mut self) -> ::std::string::String {- ::std::mem::replace(&mut self.email, ::std::string::String::new())+ pub fn take_password(&mut self) -> ::std::string::String {+ ::std::mem::replace(&mut self.password, ::std::string::String::new())}}-impl ::protobuf::Message for UserCheck {+impl ::protobuf::Message for User {fn is_initialized(&self) -> bool {true}@@ -313,6 +139,9 @@ impl ::protobuf::Message for UserCheck {2 => {::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())?;},@@ -331,6 +160,9 @@ impl ::protobuf::Message for UserCheck {if !self.email.is_empty() {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());self.cached_size.set(my_size);my_size@@ -343,6 +175,9 @@ impl ::protobuf::Message for UserCheck {if !self.email.is_empty() {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())?;::std::result::Result::Ok(())}@@ -373,8 +208,8 @@ impl ::protobuf::Message for UserCheck {Self::descriptor_static()}- fn new() -> UserCheck {- UserCheck::new()+ fn new() -> User {+ User::new()}fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {@@ -383,67 +218,68 @@ impl ::protobuf::Message for UserCheck {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 },+ |m: &User| { &m.name },+ |m: &mut User| { &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 },+ |m: &User| { &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::<UserCheck>(- "UserCheck",+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<User>(+ "User",fields,file_descriptor_proto())})}- fn default_instance() -> &'static UserCheck {- static instance: ::protobuf::rt::LazyV2<UserCheck> = ::protobuf::rt::LazyV2::INIT;- instance.get(UserCheck::new)+ fn default_instance() -> &'static User {+ static instance: ::protobuf::rt::LazyV2<User> = ::protobuf::rt::LazyV2::INIT;+ instance.get(User::new)}}-impl ::protobuf::Clear for UserCheck {+impl ::protobuf::Clear for User {fn clear(&mut self) {self.name.clear();self.email.clear();+ self.password.clear();self.unknown_fields.clear();}}-impl ::std::fmt::Debug for UserCheck {+impl ::std::fmt::Debug for User {fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {::protobuf::text_format::fmt(self, f)}}-impl ::protobuf::reflect::ProtobufValue for UserCheck {+impl ::protobuf::reflect::ProtobufValue for User {fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {::protobuf::reflect::ReflectValueRef::Message(self)}}static file_descriptor_proto_data: &'static [u8] = b"\- \n\nuser.proto\"0\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\- \x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x14\n\x05email\x18\x02\- \x20\x01(\tR\x05emailJ\x9e\x02\n\x06\x12\x04\0\0\t\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\x0c\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x14\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\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x12\x13\n\- \x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x15\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\x10\- \n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x13\x14\n\n\n\x02\x04\x01\x12\- \x04\x06\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x11\n\x0b\n\x04\- \x04\x01\x02\0\x12\x03\x07\x04\x14\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\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\+ \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\x12\x1a\n\x08password\+ \x18\x03\x20\x01(\tR\x08passwordJ\xcf\x01\n\x06\x12\x04\0\0\x06\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\x0c\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\+ \x04\x14\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\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\+ \x12\x13\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x15\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\x10\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x13\x14\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\x17b\x06proto3\";static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;diff --git a/rust-lib/flowy-user/src/protobuf/proto/sign_in.proto b/rust-lib/flowy-user/src/protobuf/proto/sign_in.protonew file mode 100644index 0000000000..91dc2b175c--- /dev/null+++ b/rust-lib/flowy-user/src/protobuf/proto/sign_in.proto@@ -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;+}diff --git a/rust-lib/flowy-user/src/protobuf/proto/sign_up.proto b/rust-lib/flowy-user/src/protobuf/proto/sign_up.protonew file mode 100644index 0000000000..6940c9ef61--- /dev/null+++ b/rust-lib/flowy-user/src/protobuf/proto/sign_up.proto@@ -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;+}diff --git a/rust-lib/flowy-user/src/protobuf/proto/user.proto b/rust-lib/flowy-user/src/protobuf/proto/user.protoindex 992fad8d46..22471a969e 100644--- a/rust-lib/flowy-user/src/protobuf/proto/user.proto+++ b/rust-lib/flowy-user/src/protobuf/proto/user.proto@@ -3,8 +3,5 @@ syntax = "proto3";message User {string name = 1;string email = 2;-}-message UserCheck {- string name = 1;- string email = 2;+ string password = 3;}diff --git a/scripts/flowy-tool/src/proto/proto_gen.rs b/scripts/flowy-tool/src/proto/proto_gen.rsindex 05d7819d3b..9941422f76 100644--- a/scripts/flowy-tool/src/proto/proto_gen.rs+++ b/scripts/flowy-tool/src/proto/proto_gen.rs@@ -1,10 +1,9 @@use crate::proto::ast::*;use crate::proto::helper::*;use crate::{proto::template::*, util::*};-use flowy_ast::*;-use shell::*;+use std::{fs::OpenOptions, io::Write};-use syn::Item;+use walkdir::WalkDir;pub struct ProtoGen {diff --git a/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.rs b/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.rsindex a348f0006e..508953712a 100644--- a/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.rs+++ b/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.rs@@ -2,7 +2,7 @@ use crate::proto::helper::{CrateProtoInfo, FileProtoInfo};use crate::util::{get_tera, read_file};use std::fs::OpenOptions;use std::io::Write;-use tera::{Context, Tera};+use tera::Context;pub struct ProtobufDeriveMeta {context: Context,diff --git a/scripts/flowy-tool/src/proto/template/proto_file/enum_template.rs b/scripts/flowy-tool/src/proto/template/proto_file/enum_template.rsindex 5950a51367..a93337c0b9 100644--- a/scripts/flowy-tool/src/proto/template/proto_file/enum_template.rs+++ b/scripts/flowy-tool/src/proto/template/proto_file/enum_template.rs@@ -1,6 +1,6 @@use crate::proto::ast::FlowyEnum;use crate::util::get_tera;-use tera::{Context, Tera};+use tera::Context;pub struct EnumTemplate {context: Context,diff --git a/scripts/flowy-tool/src/proto/template/proto_file/struct_template.rs b/scripts/flowy-tool/src/proto/template/proto_file/struct_template.rsindex 5a926b22d7..f45519151c 100644--- a/scripts/flowy-tool/src/proto/template/proto_file/struct_template.rs+++ b/scripts/flowy-tool/src/proto/template/proto_file/struct_template.rs@@ -1,7 +1,7 @@use crate::util::get_tera;use flowy_ast::*;use phf::phf_map;-use tera::{Context, Tera};+use tera::Context;// Protobuf data type : https://developers.google.com/protocol-buffers/docs/proto3static RUST_TYPE_MAP: phf::Map<&'static str, &'static str> = phf_map! {