Skip to content
Snippets Groups Projects
Commit db22667e authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Beamsplitter: document errors.

parent 2e4982fc
No related branches found
No related tags found
No related merge requests found
Pipeline #7427 passed with warnings
......@@ -28,6 +28,10 @@ pub struct BeamSplitter {
impl BeamSplitter {
/// Creates a new [`BeamSplitter`] with a given splitting ratio.
///
/// ## Errors
/// This function returns an [`OpossumError::Other`] if the splitting ratio is outside the closed interval
/// [0.0..1.0].
pub fn new(ratio: f64) -> Result<Self> {
if (0.0..=1.0).contains(&ratio) {
Ok(Self { ratio })
......@@ -44,6 +48,10 @@ impl BeamSplitter {
}
/// Sets the splitting ratio of this [`BeamSplitter`].
///
/// ## Errors
/// This function returns an [`OpossumError::Other`] if the splitting ratio is outside the closed interval
/// [0.0..1.0].
pub fn set_ratio(&mut self, ratio: f64) -> Result<()> {
if (0.0..=1.0).contains(&ratio) {
self.ratio = ratio;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment