This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC, abstractmethod | |
from typing import Any, Generic, TypeVar | |
# from numbers import Real | |
T = TypeVar("T") | |
class JsonAdapter(ABC, Generic[T]): | |
@abstractmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::sync::{Arc, RwLock}; | |
use std::thread; | |
#[derive(Debug, Default)] | |
struct SharedDataStruct { | |
value: i32, | |
} | |
#[derive(Clone, Debug, Default)] | |
struct SharedData(Arc<RwLock<SharedDataStruct>>); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn init() { | |
static INIT_ONCE: std::sync::Once = std::sync::Once::new(); | |
INIT_ONCE.call_once(|| { | |
let mut zero__2 = 0; | |
{ | |
*ZERO__2.write().unwrap() = Some(zero__2); | |
} | |
zero__2 = zero__2; | |
{ | |
*ZERO__2.write().unwrap() = Some(zero__2); |