script to enable/disable no_deadlocks::RwLock instead of std::sync::RwLock

This commit is contained in:
Michael Sippel 2021-03-30 22:47:05 +02:00
parent 0fcf852b72
commit c63fd6d1f2
Signed by: senvas
GPG key ID: F96CF119C34B64A6
22 changed files with 60 additions and 28 deletions

View file

@ -6,6 +6,7 @@ name = "NeStEd"
version = "0.1.0"
[dependencies]
no_deadlocks = "*"
cgmath = "0.17.0"
termion = "1.5.5"
signal-hook = "0.3.1"

16
enable_nodeadlock.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
enable_no_deadlock() {
for f in $(find src -name *.rs)
do
sed -ibak -E "s/std::sync::RwLock(;|,|$)/no_deadlocks::RwLock\1/g" $f
done
}
disable_no_deadlock() {
for f in $(find src -name *.rs)
do
sed -ibak -E "s/no_deadlocks::RwLock(;|,|$)/std::sync::RwLock\1/g" $f
done
}

View file

@ -1,11 +1,12 @@
use {
async_std::stream::StreamExt,
std::{
sync::{Arc, RwLock},
sync::Arc,
collections::HashMap,
cmp::{min, max}
},
cgmath::{Point2, Vector2},
std::sync::RwLock,
crate::{
core::{InnerViewPort, OuterViewPort, Observer, ObserverExt, ObserverBroadcast, ChannelReceiver, ChannelSender},
terminal::{TerminalView, TerminalAtom},

View file

@ -1,8 +1,9 @@
use {
crate::core::View,
std::{
sync::{Arc, Weak, RwLock}
}
sync::{Arc, Weak}
},
std::sync::RwLock
};
/*\

View file

@ -1,5 +1,7 @@
use {
std::sync::{Arc, RwLock},
std::sync::Arc,
std::any::Any,
std::sync::RwLock,
crate::core::{
View,
Observer,

View file

@ -11,7 +11,8 @@ pub trait View : Send + Sync {
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
use std::sync::{Arc, RwLock};
use std::sync::Arc;
use std::sync::RwLock;
impl<V: View + ?Sized> View for RwLock<V> {
type Msg = V::Msg;

View file

@ -1,8 +1,7 @@
use {
std::{
sync::{Arc, RwLock}
},
std::sync::Arc,
cgmath::{Point2, Vector2},
std::sync::RwLock,
crate::{
core::{
View,

View file

@ -1,8 +1,9 @@
pub use {
std::{
sync::{Arc, RwLock},
sync::Arc,
boxed::Box
},
std::sync::RwLock,
crate::{
core::{
View,

View file

@ -1,8 +1,9 @@
pub use {
std::{
sync::{Arc, RwLock},
sync::Arc,
boxed::Box
},
std::sync::RwLock,
crate::{
core::{
View,

View file

@ -4,9 +4,10 @@ pub mod map_key;
use {
std::{
sync::{Arc, RwLock},
sync::Arc,
ops::Deref,
},
std::sync::RwLock,
crate::core::View
};

View file

@ -1,8 +1,9 @@
use {
std::{
sync::{Arc, RwLock},
sync::{Arc},
collections::HashSet
},
std::sync::RwLock,
cgmath::Point2,
crate::{
core::{ViewPort, Observer, ObserverExt, ObserverBroadcast, InnerViewPort, OuterViewPort},

View file

@ -14,9 +14,8 @@ pub mod leveled_term_view;
use {
async_std::{task},
std::{
sync::{Arc, RwLock}
},
std::sync::{Arc},
std::sync::RwLock,
cgmath::{Vector2, Point2},
termion::event::{Event, Key},
crate::{

View file

@ -2,11 +2,12 @@ use {
std::{
cmp::{max},
any::Any,
sync::{Arc, RwLock, Weak}
sync::{Arc, Weak},
},
async_std::{
stream::StreamExt
},
std::sync::RwLock,
crate::{
core::{View, Observer, ObserverExt, OuterViewPort, channel::{channel, ChannelData, ChannelSender, ChannelReceiver}},
singleton::{SingletonView},

View file

@ -1,9 +1,10 @@
use {
async_std::stream::StreamExt,
std::{
sync::{Arc, Weak, RwLock},
sync::{Arc, Weak},
collections::{HashMap, HashSet}
},
std::sync::RwLock,
crate::{
core::{
View, Observer, ObserverExt, ObserverBroadcast,

View file

@ -22,9 +22,10 @@ pub trait SequenceView : View<Msg = usize> {
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
use std::{
sync::{Arc, RwLock},
sync::Arc,
ops::{Deref}
};
use std::sync::RwLock;
impl<V: SequenceView + ?Sized> SequenceView for RwLock<V> {
type Item = V::Item;

View file

@ -1,7 +1,8 @@
use {
std::{
sync::{Arc, RwLock}
sync::Arc
},
std::sync::RwLock,
crate::{
core::{
View, Observer, ObserverExt, ObserverBroadcast,

View file

@ -1,8 +1,9 @@
use {
std::{
sync::{Arc, RwLock},
sync::Arc,
ops::{Deref, DerefMut}
},
std::sync::RwLock,
crate::{
core::{View, Observer, ObserverExt, ObserverBroadcast, ViewPort, InnerViewPort, OuterViewPort},
sequence::SequenceView,

View file

@ -1,7 +1,8 @@
use {
std::{
sync::{Arc, RwLock}
sync::{Arc}
},
std::sync::RwLock,
crate::{
core::{
Observer,

View file

@ -3,9 +3,10 @@ pub mod buffer;
use {
std::{
sync::{Arc, RwLock},
sync::Arc,
ops::Deref
},
std::sync::RwLock,
crate::core::{View}
};

View file

@ -1,7 +1,5 @@
use {
std::{
sync::{RwLock}
},
std::sync::RwLock,
crate::{
core::{ViewPort, OuterViewPort},
singleton::{SingletonView, SingletonBuffer},
@ -101,12 +99,13 @@ impl StringEditor {
pub mod insert_view {
use {
std::{
sync::{Arc, RwLock},
sync::Arc,
cmp::{min, max},
any::Any,
collections::HashSet
},
cgmath::Point2,
std::sync::RwLock,
crate::{
core::{View, Observer, ObserverExt, ObserverBroadcast, OuterViewPort, InnerViewPort},
terminal::{TerminalAtom, TerminalStyle, TerminalView},

View file

@ -1,8 +1,9 @@
use {
std::{
sync::{Arc, Weak, RwLock},
sync::{Arc, Weak},
collections::HashMap
},
std::sync::RwLock,
cgmath::Point2,
crate::{
core::{InnerViewPort, OuterViewPort, Observer, ObserverExt, ObserverBroadcast},

View file

@ -1,9 +1,10 @@
use {
std::{
sync::{Arc, RwLock},
sync::Arc,
io::{Write, stdout, stdin},
collections::HashSet
},
std::sync::RwLock,
async_std::{
stream::StreamExt,
task