mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix StackView::{get, get_mut}
This commit is contained in:
parent
a31dd01e5e
commit
927afafe88
@ -80,7 +80,7 @@ impl<T: View> ChildWrapper<T> {
|
|||||||
|
|
||||||
impl<T: View> ChildWrapper<T> {
|
impl<T: View> ChildWrapper<T> {
|
||||||
/// Returns a reference to the inner view
|
/// Returns a reference to the inner view
|
||||||
pub fn get_inner(&self) -> &View {
|
pub fn get_inner(&self) -> &T {
|
||||||
match *self {
|
match *self {
|
||||||
ChildWrapper::Shadow(ref shadow) => shadow.get_inner().get_inner(),
|
ChildWrapper::Shadow(ref shadow) => shadow.get_inner().get_inner(),
|
||||||
ChildWrapper::Backfilled(ref background) => background.get_inner(),
|
ChildWrapper::Backfilled(ref background) => background.get_inner(),
|
||||||
@ -89,7 +89,7 @@ impl<T: View> ChildWrapper<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a mutable reference to the inner view
|
/// Returns a mutable reference to the inner view
|
||||||
pub fn get_inner_mut(&mut self) -> &mut View {
|
pub fn get_inner_mut(&mut self) -> &mut T {
|
||||||
match *self {
|
match *self {
|
||||||
ChildWrapper::Shadow(ref mut shadow) => {
|
ChildWrapper::Shadow(ref mut shadow) => {
|
||||||
shadow.get_inner_mut().get_inner_mut()
|
shadow.get_inner_mut().get_inner_mut()
|
||||||
@ -228,7 +228,7 @@ impl StackView {
|
|||||||
/// Returns a reference to the layer at the given position.
|
/// Returns a reference to the layer at the given position.
|
||||||
pub fn get(&self, pos: LayerPosition) -> Option<&View> {
|
pub fn get(&self, pos: LayerPosition) -> Option<&View> {
|
||||||
let i = self.get_index(pos);
|
let i = self.get_index(pos);
|
||||||
self.layers.get(i).map(|child| child.view.get_inner())
|
self.layers.get(i).map(|child| &**child.view.get_inner())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a mutable reference to the layer at the given position.
|
/// Returns a mutable reference to the layer at the given position.
|
||||||
@ -236,7 +236,7 @@ impl StackView {
|
|||||||
let i = self.get_index(pos);
|
let i = self.get_index(pos);
|
||||||
self.layers
|
self.layers
|
||||||
.get_mut(i)
|
.get_mut(i)
|
||||||
.map(|child| child.view.get_inner_mut())
|
.map(|child| &mut **child.view.get_inner_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Looks for the layer containing a view with the given ID.
|
/// Looks for the layer containing a view with the given ID.
|
||||||
|
Loading…
Reference in New Issue
Block a user