summaryrefslogtreecommitdiff
path: root/benoit-cli/src/instance/mod.rs
blob: 26f67a0dd41879b65c513fa2ef254dc65f846d48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
	Copyright 2021, 2023-2024 Gabriel Bjørnager Jen-
	sen.

	This file is part of benoit-cli.

	benoit-cli is free software: you can redistrib-
	ute it and/or modify it under the terms of the
	GNU General Public License as published by the
	Free Software Foundation, either version 3 of
	the License, or (at your option) any later ver-
	sion.

	benoit-cli is distributed in the hope that it
	will be useful, but WITHOUT ANY WARRANTY; with-
	out even the implied warranty of MERCHANTABILITY
	or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
	General Public License for more details.

	You should have received a copy of the GNU Gene-
	ral Public License along with benoit-cli. If
	not, see <https://www.gnu.org/licenses/>.
*/

//! Runtime.

mod run;

use rug::float::{free_cache, FreeCache};

/// Denotes a programme instance.
///
/// In theory, due to Rust's safety, any ammount of instances can be created at any time... disregarding hardware constraints, of course.
///
/// The choice of creating this structure in the first place is a personal one.
/// I can be argued, however, that some things should be leveraged using [`Drop`].
pub struct Instance;

impl Default for Instance {
	#[inline(always)]
	fn default() -> Self { Self }
}

impl Drop for Instance {
	fn drop(&mut self) {
		free_cache(FreeCache::All);
	}
}