{"record":{"id":"ec360042dbabfc3a","repo":"emilk/egui","slug":"axis-must-be-0-or-1-got-axis","errorCode":null,"errorMessage":"axis must be 0 or 1, got {axis}","messagePattern":"axis must be 0 or 1, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/emath/src/rect.rs","lineNumber":490,"sourceCode":"    }\n\n    #[inline(always)]\n    pub fn y_range(&self) -> Rangef {\n        Rangef::new(self.min.y, self.max.y)\n    }\n\n    /// The extent along the given axis: `0` for x, `1` for y.\n    ///\n    /// Equivalent to [`Self::x_range`] for `axis == 0` and [`Self::y_range`] for `axis == 1`.\n    ///\n    /// # Panics\n    /// If `axis` is not `0` or `1`.\n    #[inline]\n    pub fn range_along(&self, axis: usize) -> Rangef {\n        match axis {\n            0 => self.x_range(),\n            1 => self.y_range(),\n            _ => panic!(\"axis must be 0 or 1, got {axis}\"),\n        }\n    }\n\n    /// The size along the given axis: `0` for x (width), `1` for y (height).\n    ///\n    /// Equivalent to `self.size()[axis]`.\n    ///\n    /// # Panics\n    /// If `axis` is not `0` or `1`.\n    #[inline]\n    pub fn size_along(&self, axis: usize) -> f32 {\n        self.size()[axis]\n    }\n\n    #[inline(always)]\n    pub fn bottom_up_range(&self) -> Rangef {\n        Rangef::new(self.max.y, self.min.y)\n    }","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/emilk/egui/blob/b9a0723d88dee87ba0965470b554a6efdab1d0bb/crates/emath/src/rect.rs#L472-L508","documentation":"Error \"axis must be 0 or 1, got {axis}\" thrown in emilk/egui.","triggerScenarios":"Thrown at crates/emath/src/rect.rs:490 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only 0 (horizontal/x) or 1 (vertical/y) as the axis argument."],"exampleFix":"let len = if horizontal { rect.width() } else { rect.height() };","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b9a0723d88dee87ba0965470b554a6efdab1d0bb","analyzedAt":"2026-08-19T12:39:57.743Z","contentChangedAt":"2026-08-19T12:39:57.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}