Skip to content
Snippets Groups Projects
Select Git revision
  • 734819ddb43b1b5d5153aab39e3ab056f25d0b32
  • master default protected
  • traduccio_barbara
  • Catalan-translation
  • feature/cesium_plus_pod_2
  • feature/add_pubkey_icon
  • feature/startup_node_selection
  • develop
  • feature/android_api_19
  • Vivakvo/cesium-patch-8
  • gitlab_migration_1
  • dev
  • rml8
  • v1.6.12
  • v1.6.11
  • v1.6.10
  • v1.6.9
  • v1.6.8
  • v1.6.7
  • v1.6.6
  • v1.6.5
  • v1.6.4
  • v1.6.3
  • v1.6.2
  • v1.6.2-alpha
  • v1.6.1
  • v1.6.0
  • v1.5.12
  • v1.5.11
  • v1.5.10
  • v1.5.9
  • v1.5.8
  • v1.5.7
33 results

gulpfile.js

Blame
  • Forked from clients / Cesium-grp / Cesium
    Source project has a limited visibility.
    gva_block_db.rs 1.84 KiB
    //  Copyright (C) 2020 Éloïs SANCHEZ.
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    
    use crate::*;
    use dubp::block::{DubpBlock, DubpBlockV10};
    
    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
    #[repr(transparent)]
    pub struct GvaBlockDbV1(pub DubpBlock);
    
    impl Default for GvaBlockDbV1 {
        fn default() -> Self {
            Self(DubpBlock::V10(DubpBlockV10::default()))
        }
    }
    
    impl AsBytes for GvaBlockDbV1 {
        fn as_bytes<T, F: FnMut(&[u8]) -> T>(&self, mut f: F) -> T {
            f(&bincode::serialize(&self).unwrap_or_else(|_| unreachable!()))
        }
    }
    
    impl kv_typed::prelude::FromBytes for GvaBlockDbV1 {
        type Err = bincode::Error;
    
        fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
            bincode::deserialize(bytes)
        }
    }
    
    impl ToDumpString for GvaBlockDbV1 {
        fn to_dump_string(&self) -> String {
            todo!()
        }
    }
    
    #[cfg(feature = "explorer")]
    impl ExplorableValue for GvaBlockDbV1 {
        fn from_explorer_str(source: &str) -> Result<Self, FromExplorerValueErr> {
            serde_json::from_str(source).map_err(|e| FromExplorerValueErr(e.into()))
        }
        fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
            serde_json::to_value(&self).map_err(|e| KvError::DeserError(e.into()))
        }
    }