Struct blue_engine::Engine
source · pub struct Engine {
pub renderer: Renderer,
pub event_loop: EventLoop<()>,
pub window: Window,
pub objects: ObjectStorage,
pub camera: Camera,
pub signals: SignalStorage,
}
Expand description
The engine is the main starting point of using the Blue Engine. Everything that runs on Blue Engine will be under this struct. The structure of engine is monolithic, but the underlying data and the way it works is not. It gives a set of default data to work with, but also allow you to go beyond that and work as low level as you wish to.
You can also use the Engine to build you own custom structure the way you wish for it to be. Possibilities are endless!
To start using the Blue Engine, you can start by creating a new Engine like follows:
use blue_engine::header::{Engine, WindowDescriptor};
fn main() {
let engine = Engine::new(WindowDescriptor::default()).expect("Couldn't create the engine");
}
The WindowDescriptor simply holds what features you would like for your window. If you are reading this on later version of the engine, you might be able to even run the engine in headless mode meaning there would not be a need for a window and the renders would come as image files.
If you so wish to have a window, you would need to start a window update loop. The update loop of window runs a frame every few millisecond, and gives you details of what is happening during this time, like input events. You can also modify existing parts of the engine during this update loop, such as changing camera to look differently, or creating a new object on the scene, or even changing window details!
The update loop is just a method of the Engine struct that have one argument which is a callback function.
[THE DATA HERE IS WORK IN PROGRESS!]
Fields§
§renderer: Renderer
The renderer does exactly what it is called. It works with the GPU to render frames according to the data you gave it.
event_loop: EventLoop<()>
The event_loop handles the events of the window and inputs, so it’s used internally
window: Window
The window handles everything about window and inputs. This includes ability to modify window and listen to input devices for changes.
objects: ObjectStorage
The object system is a way to make it easier to work with the engine. Obviously you can work without it, but it’s for those who do not have the know-how, or wish to handle all the work of rendering data manually.
camera: Camera
The camera handles the way the scene looks when rendered. You can modify everything there is to camera through this.
signals: SignalStorage
Handles all engine plugins
Implementations§
source§impl Engine
impl Engine
sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new window in current thread using default settings.
Examples found in repository?
More examples
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
// set scissor rect
engine.renderer.scissor_rect = Some((0, 0, 450, 350));
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine.renderer.clear_color = wgpu::Color {
r: 0.0,
g: 0.0,
b: 1.0,
a: 1.0,
};
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings {
shader_settings: ShaderSettings {
polygon_mode: wgpu::PolygonMode::Line,
..Default::default()
},
..Default::default()
},
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
fn main() {
let mut engine = Engine::new().expect("win");
cube("Cube", &mut engine.renderer, &mut engine.objects).unwrap();
engine
.objects
.get_mut("Cube")
.unwrap()
.set_color(0f32, 0f32, 1f32, 1f32)
.unwrap();
let radius = 5f32;
let start = std::time::SystemTime::now();
engine
.update_loop(move |_, _, _, _, camera, _| {
let camx = start.elapsed().unwrap().as_secs_f32().sin() * radius;
let camy = start.elapsed().unwrap().as_secs_f32().sin() * radius;
let camz = start.elapsed().unwrap().as_secs_f32().cos() * radius;
camera
.set_position(camx, camy, camz)
.expect("Couldn't update the camera eye");
})
.expect("Error during update loop");
}
sourcepub fn new_config(settings: WindowDescriptor) -> Result<Self>
pub fn new_config(settings: WindowDescriptor) -> Result<Self>
Creates a new window in current thread using provided settings.
Examples found in repository?
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
fn main() {
let mut engine = Engine::new_config(blue_engine::WindowDescriptor {
power_preference: blue_engine::PowerPreference::LowPower,
present_mode: blue_engine::wgpu::PresentMode::Immediate,
..Default::default()
})
.expect("win");
//let test_instance = Instance::default();
//println!("{:?}", test_instance.to_raw());
let texture = engine
.renderer
.build_texture(
"background",
TextureData::Path("resources/BlueLogoDiscord.png".to_string()),
blue_engine::TextureMode::Clamp,
)
.unwrap();
let texture2 = engine
.renderer
.build_texture(
"background",
TextureData::Path("resources/player.png".to_string()),
blue_engine::TextureMode::Clamp,
)
.unwrap();
let texture3 = engine
.renderer
.build_texture(
"background",
TextureData::Path("resources/image.png".to_string()),
blue_engine::TextureMode::Clamp,
)
.unwrap();
square(
"main",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
);
engine.objects.get_mut("main").unwrap().set_texture(texture);
engine
.objects
.get_mut("main")
.unwrap()
.set_position(-1f32, 0f32, 0f32);
square(
"alt",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
);
engine.objects.get_mut("alt").unwrap().set_texture(texture2);
engine
.objects
.get_mut("alt")
.unwrap()
.set_position(0.2f32, 0f32, 0.001f32);
square(
"alt2",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
);
engine
.objects
.get_mut("alt2")
.unwrap()
.set_texture(texture3);
engine
.objects
.get_mut("alt2")
.unwrap()
.set_position(-0.2f32, 0f32, 0.001f32);
let speed = -0.05;
let mut last_time = std::time::Instant::now();
let mut frames = 0;
engine
.update_loop(move |renderer, _window, objects, input, camera, plugins| {
// calculate FPS
let current_time = std::time::Instant::now();
frames += 1;
if current_time - last_time >= std::time::Duration::from_secs(1) {
println!("{}ms/frame", 1000f32 / frames as f32);
frames = 0;
last_time = current_time;
}
let sprite = objects.get_mut("alt").unwrap();
if input.key_held(blue_engine::KeyCode::ArrowUp) {
sprite.set_position(
sprite.position.x,
sprite.position.y - speed,
sprite.position.z,
);
//lm.ambient_color.data = [1f32, 1f32, 1f32, 1f32];
}
if input.key_held(blue_engine::KeyCode::ArrowDown) {
sprite.set_position(
sprite.position.x,
sprite.position.y + speed,
sprite.position.z,
);
//lm.ambient_color.data = [0.1f32, 0.1f32, 0.1f32, 1f32];
}
if input.key_held(blue_engine::KeyCode::ArrowLeft) {
sprite.set_position(
sprite.position.x + speed,
sprite.position.y,
sprite.position.z,
);
}
if input.key_held(blue_engine::KeyCode::ArrowRight) {
sprite.set_position(
sprite.position.x - speed,
sprite.position.y,
sprite.position.z,
);
}
if input.key_held(blue_engine::KeyCode::KeyE) {
sprite.set_position(
sprite.position.x,
sprite.position.y,
sprite.position.z + speed,
);
}
if input.key_held(blue_engine::KeyCode::KeyQ) {
sprite.set_position(
sprite.position.x,
sprite.position.y,
sprite.position.z - speed,
);
}
})
.expect("Error during update loop");
}
sourcepub fn update_loop<F: 'static + FnMut(&mut Renderer, &mut Window, &mut ObjectStorage, &WinitInputHelper, &mut Camera, &mut SignalStorage)>(
self,
update_function: F
) -> Result<()>
pub fn update_loop<F: 'static + FnMut(&mut Renderer, &mut Window, &mut ObjectStorage, &WinitInputHelper, &mut Camera, &mut SignalStorage)>( self, update_function: F ) -> Result<()>
Runs the block of code that you pass to it every frame. The update code is used to modify the engine on the fly thus creating interactive graphics and making things happy in the engine!
Renderer, window, vec of objects, events, and camera are passed to the update code.
Examples found in repository?
More examples
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
// set scissor rect
engine.renderer.scissor_rect = Some((0, 0, 450, 350));
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings::default(),
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine.renderer.clear_color = wgpu::Color {
r: 0.0,
g: 0.0,
b: 1.0,
a: 1.0,
};
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
pub fn main() {
let mut engine = Engine::new().expect("win");
triangle(
"Triangle",
ObjectSettings {
shader_settings: ShaderSettings {
polygon_mode: wgpu::PolygonMode::Line,
..Default::default()
},
..Default::default()
},
&mut engine.renderer,
&mut engine.objects,
)
.unwrap();
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
fn main() {
let mut engine = Engine::new().expect("win");
cube("Cube", &mut engine.renderer, &mut engine.objects).unwrap();
engine
.objects
.get_mut("Cube")
.unwrap()
.set_color(0f32, 0f32, 1f32, 1f32)
.unwrap();
let radius = 5f32;
let start = std::time::SystemTime::now();
engine
.update_loop(move |_, _, _, _, camera, _| {
let camx = start.elapsed().unwrap().as_secs_f32().sin() * radius;
let camy = start.elapsed().unwrap().as_secs_f32().sin() * radius;
let camz = start.elapsed().unwrap().as_secs_f32().cos() * radius;
camera
.set_position(camx, camy, camz)
.expect("Couldn't update the camera eye");
})
.expect("Error during update loop");
}
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
source§fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
source§fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
source§fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
source§fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
source§fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
source§fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
source§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
source§fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
source§fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
source§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
source§fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
source§fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
source§fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
source§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
source§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
source§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
source§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
source§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
source§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
source§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
source§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
source§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
source§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
source§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
source§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
source§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
source§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
source§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
source§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
source§fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
source§fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
source§fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
source§fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
source§fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
source§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
source§fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
source§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read moresource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.