<commit_before>//! Networking primitives for Uni.rs

use cell::GlobalCell;

use thread::Scheduler;

mod imp;

mod pkt;
mod intf;
mod conn;

mod eth;

pub mod defs;

pub use self::pkt::Packet;
pub use self::imp::{Instance, InstanceWeak};

pub use self::intf::{Interface, InterfaceWeak, InterfaceRaw, V4Configuration};

static STACK: GlobalCell<Instance> = GlobalCell::new();

/// Uni.rs network stack
pub struct Stack;

impl Stack {
    #[doc(hidden)]
    pub fn init() {
        STACK.set(Instance::new());

        // Spawn the network thread
        Scheduler::spawn(|| {
            Instance::network_thread(STACK.as_ref().clone());
        });
    }

    /// Returns interfaces registered in the network stack
    pub fn instance() -> Instance {
        STACK.as_ref().clone()
    }<commit_msg>net: Module conn is now public<commit_after>//! Networking primitives for Uni.rs

use cell::GlobalCell;

use thread::Scheduler;

mod imp;

mod pkt;
mod intf;
pub mod conn;

mod eth;

pub mod defs;

pub use self::pkt::Packet;
pub use self::imp::{Instance, InstanceWeak};

pub use self::intf::{Interface, InterfaceWeak, InterfaceRaw, V4Configuration};

static STACK: GlobalCell<Instance> = GlobalCell::new();

/// Uni.rs network stack
pub struct Stack;

impl Stack {
    #[doc(hidden)]
    pub fn init() {
        STACK.set(Instance::new());

        // Spawn the network thread
        Scheduler::spawn(|| {
            Instance::network_thread(STACK.as_ref().clone());
        });
    }

    /// Returns interfaces registered in the network stack
    pub fn instance() -> Instance {
        STACK.as_ref().clone()
    }
{'fraction_non_alphanumeric': 0.13790970933828076, 'fraction_numerical': 0.0012368583797155227, 'mean_word_length': 3.224543080939948, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3253579', 'n_tokens_mistral': 512, 'n_tokens_neox': 500, 'n_words': 146}