mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: rename some struct in Rust
This commit is contained in:
@ -12,14 +12,14 @@ class DocumentService {
|
|||||||
await FolderEventSetLatestView(ViewId(value: docId)).send();
|
await FolderEventSetLatestView(ViewId(value: docId)).send();
|
||||||
|
|
||||||
final payload = TextBlockId(value: docId);
|
final payload = TextBlockId(value: docId);
|
||||||
return BlockEventGetBlockData(payload).send();
|
return TextBlockEventGetBlockData(payload).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<TextBlockDelta, FlowyError>> composeDelta({required String docId, required String data}) {
|
Future<Either<TextBlockDelta, FlowyError>> composeDelta({required String docId, required String data}) {
|
||||||
final payload = TextBlockDelta.create()
|
final payload = TextBlockDelta.create()
|
||||||
..blockId = docId
|
..blockId = docId
|
||||||
..deltaStr = data;
|
..deltaStr = data;
|
||||||
return BlockEventApplyDelta(payload).send();
|
return TextBlockEventApplyDelta(payload).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<Unit, FlowyError>> closeDocument({required String docId}) {
|
Future<Either<Unit, FlowyError>> closeDocument({required String docId}) {
|
||||||
|
@ -10,7 +10,7 @@ class ShareService {
|
|||||||
..viewId = docId
|
..viewId = docId
|
||||||
..exportType = type;
|
..exportType = type;
|
||||||
|
|
||||||
return BlockEventExportDocument(request).send();
|
return TextBlockEventExportDocument(request).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<ExportData, FlowyError>> exportText(String docId) {
|
Future<Either<ExportData, FlowyError>> exportText(String docId) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
/// Auto generate. Do not edit
|
/// Auto generate. Do not edit
|
||||||
part of '../../dispatch.dart';
|
part of '../../dispatch.dart';
|
||||||
class BlockEventGetBlockData {
|
class TextBlockEventGetBlockData {
|
||||||
TextBlockId request;
|
TextBlockId request;
|
||||||
BlockEventGetBlockData(this.request);
|
TextBlockEventGetBlockData(this.request);
|
||||||
|
|
||||||
Future<Either<TextBlockDelta, FlowyError>> send() {
|
Future<Either<TextBlockDelta, FlowyError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = BlockEvent.GetBlockData.toString()
|
..event = TextBlockEvent.GetBlockData.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
@ -18,13 +18,13 @@ class BlockEventGetBlockData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlockEventApplyDelta {
|
class TextBlockEventApplyDelta {
|
||||||
TextBlockDelta request;
|
TextBlockDelta request;
|
||||||
BlockEventApplyDelta(this.request);
|
TextBlockEventApplyDelta(this.request);
|
||||||
|
|
||||||
Future<Either<TextBlockDelta, FlowyError>> send() {
|
Future<Either<TextBlockDelta, FlowyError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = BlockEvent.ApplyDelta.toString()
|
..event = TextBlockEvent.ApplyDelta.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
@ -35,13 +35,13 @@ class BlockEventApplyDelta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlockEventExportDocument {
|
class TextBlockEventExportDocument {
|
||||||
ExportPayload request;
|
ExportPayload request;
|
||||||
BlockEventExportDocument(this.request);
|
TextBlockEventExportDocument(this.request);
|
||||||
|
|
||||||
Future<Either<ExportData, FlowyError>> send() {
|
Future<Either<ExportData, FlowyError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = BlockEvent.ExportDocument.toString()
|
..event = TextBlockEvent.ExportDocument.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
|
@ -9,20 +9,20 @@
|
|||||||
import 'dart:core' as $core;
|
import 'dart:core' as $core;
|
||||||
import 'package:protobuf/protobuf.dart' as $pb;
|
import 'package:protobuf/protobuf.dart' as $pb;
|
||||||
|
|
||||||
class BlockEvent extends $pb.ProtobufEnum {
|
class TextBlockEvent extends $pb.ProtobufEnum {
|
||||||
static const BlockEvent GetBlockData = BlockEvent._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetBlockData');
|
static const TextBlockEvent GetBlockData = TextBlockEvent._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetBlockData');
|
||||||
static const BlockEvent ApplyDelta = BlockEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ApplyDelta');
|
static const TextBlockEvent ApplyDelta = TextBlockEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ApplyDelta');
|
||||||
static const BlockEvent ExportDocument = BlockEvent._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ExportDocument');
|
static const TextBlockEvent ExportDocument = TextBlockEvent._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ExportDocument');
|
||||||
|
|
||||||
static const $core.List<BlockEvent> values = <BlockEvent> [
|
static const $core.List<TextBlockEvent> values = <TextBlockEvent> [
|
||||||
GetBlockData,
|
GetBlockData,
|
||||||
ApplyDelta,
|
ApplyDelta,
|
||||||
ExportDocument,
|
ExportDocument,
|
||||||
];
|
];
|
||||||
|
|
||||||
static final $core.Map<$core.int, BlockEvent> _byValue = $pb.ProtobufEnum.initByValue(values);
|
static final $core.Map<$core.int, TextBlockEvent> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||||
static BlockEvent? valueOf($core.int value) => _byValue[value];
|
static TextBlockEvent? valueOf($core.int value) => _byValue[value];
|
||||||
|
|
||||||
const BlockEvent._($core.int v, $core.String n) : super(v, n);
|
const TextBlockEvent._($core.int v, $core.String n) : super(v, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
import 'dart:core' as $core;
|
import 'dart:core' as $core;
|
||||||
import 'dart:convert' as $convert;
|
import 'dart:convert' as $convert;
|
||||||
import 'dart:typed_data' as $typed_data;
|
import 'dart:typed_data' as $typed_data;
|
||||||
@$core.Deprecated('Use blockEventDescriptor instead')
|
@$core.Deprecated('Use textBlockEventDescriptor instead')
|
||||||
const BlockEvent$json = const {
|
const TextBlockEvent$json = const {
|
||||||
'1': 'BlockEvent',
|
'1': 'TextBlockEvent',
|
||||||
'2': const [
|
'2': const [
|
||||||
const {'1': 'GetBlockData', '2': 0},
|
const {'1': 'GetBlockData', '2': 0},
|
||||||
const {'1': 'ApplyDelta', '2': 1},
|
const {'1': 'ApplyDelta', '2': 1},
|
||||||
@ -18,5 +18,5 @@ const BlockEvent$json = const {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Descriptor for `BlockEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
/// Descriptor for `TextBlockEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||||
final $typed_data.Uint8List blockEventDescriptor = $convert.base64Decode('CgpCbG9ja0V2ZW50EhAKDEdldEJsb2NrRGF0YRAAEg4KCkFwcGx5RGVsdGEQARISCg5FeHBvcnREb2N1bWVudBAC');
|
final $typed_data.Uint8List textBlockEventDescriptor = $convert.base64Decode('Cg5UZXh0QmxvY2tFdmVudBIQCgxHZXRCbG9ja0RhdGEQABIOCgpBcHBseURlbHRhEAESEgoORXhwb3J0RG9jdW1lbnQQAg==');
|
||||||
|
@ -9,16 +9,16 @@ pub fn create(block_manager: Arc<TextBlockManager>) -> Module {
|
|||||||
let mut module = Module::new().name(env!("CARGO_PKG_NAME")).data(block_manager);
|
let mut module = Module::new().name(env!("CARGO_PKG_NAME")).data(block_manager);
|
||||||
|
|
||||||
module = module
|
module = module
|
||||||
.event(BlockEvent::GetBlockData, get_block_data_handler)
|
.event(TextBlockEvent::GetBlockData, get_block_data_handler)
|
||||||
.event(BlockEvent::ApplyDelta, apply_delta_handler)
|
.event(TextBlockEvent::ApplyDelta, apply_delta_handler)
|
||||||
.event(BlockEvent::ExportDocument, export_handler);
|
.event(TextBlockEvent::ExportDocument, export_handler);
|
||||||
|
|
||||||
module
|
module
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
|
||||||
#[event_err = "FlowyError"]
|
#[event_err = "FlowyError"]
|
||||||
pub enum BlockEvent {
|
pub enum TextBlockEvent {
|
||||||
#[event(input = "TextBlockId", output = "TextBlockDelta")]
|
#[event(input = "TextBlockId", output = "TextBlockDelta")]
|
||||||
GetBlockData = 0,
|
GetBlockData = 0,
|
||||||
|
|
||||||
|
@ -24,31 +24,31 @@
|
|||||||
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2;
|
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2;
|
||||||
|
|
||||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||||
pub enum BlockEvent {
|
pub enum TextBlockEvent {
|
||||||
GetBlockData = 0,
|
GetBlockData = 0,
|
||||||
ApplyDelta = 1,
|
ApplyDelta = 1,
|
||||||
ExportDocument = 2,
|
ExportDocument = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::ProtobufEnum for BlockEvent {
|
impl ::protobuf::ProtobufEnum for TextBlockEvent {
|
||||||
fn value(&self) -> i32 {
|
fn value(&self) -> i32 {
|
||||||
*self as i32
|
*self as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_i32(value: i32) -> ::std::option::Option<BlockEvent> {
|
fn from_i32(value: i32) -> ::std::option::Option<TextBlockEvent> {
|
||||||
match value {
|
match value {
|
||||||
0 => ::std::option::Option::Some(BlockEvent::GetBlockData),
|
0 => ::std::option::Option::Some(TextBlockEvent::GetBlockData),
|
||||||
1 => ::std::option::Option::Some(BlockEvent::ApplyDelta),
|
1 => ::std::option::Option::Some(TextBlockEvent::ApplyDelta),
|
||||||
2 => ::std::option::Option::Some(BlockEvent::ExportDocument),
|
2 => ::std::option::Option::Some(TextBlockEvent::ExportDocument),
|
||||||
_ => ::std::option::Option::None
|
_ => ::std::option::Option::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn values() -> &'static [Self] {
|
fn values() -> &'static [Self] {
|
||||||
static values: &'static [BlockEvent] = &[
|
static values: &'static [TextBlockEvent] = &[
|
||||||
BlockEvent::GetBlockData,
|
TextBlockEvent::GetBlockData,
|
||||||
BlockEvent::ApplyDelta,
|
TextBlockEvent::ApplyDelta,
|
||||||
BlockEvent::ExportDocument,
|
TextBlockEvent::ExportDocument,
|
||||||
];
|
];
|
||||||
values
|
values
|
||||||
}
|
}
|
||||||
@ -56,30 +56,30 @@ impl ::protobuf::ProtobufEnum for BlockEvent {
|
|||||||
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
||||||
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||||
descriptor.get(|| {
|
descriptor.get(|| {
|
||||||
::protobuf::reflect::EnumDescriptor::new_pb_name::<BlockEvent>("BlockEvent", file_descriptor_proto())
|
::protobuf::reflect::EnumDescriptor::new_pb_name::<TextBlockEvent>("TextBlockEvent", file_descriptor_proto())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::marker::Copy for BlockEvent {
|
impl ::std::marker::Copy for TextBlockEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::default::Default for BlockEvent {
|
impl ::std::default::Default for TextBlockEvent {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
BlockEvent::GetBlockData
|
TextBlockEvent::GetBlockData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::reflect::ProtobufValue for BlockEvent {
|
impl ::protobuf::reflect::ProtobufValue for TextBlockEvent {
|
||||||
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
|
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
\n\x0fevent_map.proto*B\n\nBlockEvent\x12\x10\n\x0cGetBlockData\x10\0\
|
\n\x0fevent_map.proto*F\n\x0eTextBlockEvent\x12\x10\n\x0cGetBlockData\
|
||||||
\x12\x0e\n\nApplyDelta\x10\x01\x12\x12\n\x0eExportDocument\x10\x02b\x06p\
|
\x10\0\x12\x0e\n\nApplyDelta\x10\x01\x12\x12\n\x0eExportDocument\x10\x02\
|
||||||
roto3\
|
b\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;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
enum BlockEvent {
|
enum TextBlockEvent {
|
||||||
GetBlockData = 0;
|
GetBlockData = 0;
|
||||||
ApplyDelta = 1;
|
ApplyDelta = 1;
|
||||||
ExportDocument = 2;
|
ExportDocument = 2;
|
||||||
|
Reference in New Issue
Block a user