1234567891011121314151617181920212223242526272829303132 |
- use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
- #[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq)]
- pub enum NetworkType {
- UnknownNetworkType = 0,
- Wifi = 1,
- Cell = 2,
- Ethernet = 3,
- }
- impl NetworkType {
- pub fn is_connect(&self) -> bool {
- match self {
- NetworkType::UnknownNetworkType => false,
- NetworkType::Wifi => true,
- NetworkType::Cell => true,
- NetworkType::Ethernet => true,
- }
- }
- }
- impl std::default::Default for NetworkType {
- fn default() -> Self {
- NetworkType::UnknownNetworkType
- }
- }
- #[derive(ProtoBuf, Debug, Default, Clone)]
- pub struct NetworkState {
- #[pb(index = 1)]
- pub ty: NetworkType,
- }
|