fn foo_mut<'a>(_: &'a mut &'a String) {
// This function signature means take an exclusive reference for the entire rest of it's validity
}
fn foo<'a>(_: &'a &'a String) {}
fn main() {
let x = String::new();
let y: &String = &x;
foo(&y);
foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want
drop(x);
let i = String::new();
let mut j: &String = &i;
foo_mut(&mut i);
// Reference is eaten and still in use, so it's not possible to use `y`
// Something about &mut T being invariant over T but covariant over 'a
drop(y);
}
(edited)foo_mut(&mut j);
? then I get an error for the drop(y);
but that one has nothing to do with lifetimes. it's simply that x
has been dropped and thus y
is no longer validfoo_mut(&mut j);
? then I get an error for the drop(y);
but that one has nothing to do with lifetimes. it's simply that x
has been dropped and thus y
is no longer valid fn foo_mut<'a>(_: &'a mut &'a String) {
// This function signature means take an exclusive reference for the entire rest of it's validity
}
fn foo<'a>(_: &'a &'a String) {}
fn main() {
let x = String::new();
let mut y: &String = &x;
foo(&y);
foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want
foo_mut(&mut y);
// Reference is eaten and still in use, so it's not possible to use `y`
// Something about &mut T being invariant over T but covariant over 'a
drop(y);
}
(edited)Client()->State()
can be one of those STATE_OFFLINE, STATE_CONNECTING, STATE_LOADING, STATE_ONLINE, STATE_DEMOPLAYBACK, STATE_QUITTING, STATE_RESTARTING
Client()->State()
can be one of those STATE_OFFLINE, STATE_CONNECTING, STATE_LOADING, STATE_ONLINE, STATE_DEMOPLAYBACK, STATE_QUITTING, STATE_RESTARTING
logfile
command in the client and server console or config which takes a filename as argument. It will create a text file with all the logs including chat. There is also dump_local_console
fn foo_mut<'a>(_: &'a mut &'a String) {
// This function signature means take an exclusive reference for the entire rest of it's validity
}
fn foo<'a>(_: &'a &'a String) {}
fn main() {
let x = String::new();
let mut y: &String = &x;
foo(&y);
foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want
foo_mut(&mut y);
// Reference is eaten and still in use, so it's not possible to use `y`
// Something about &mut T being invariant over T but covariant over 'a
drop(y);
}
(edited)let y
must be let mut y
. do you even compile your examples? you should! the compiler gives better errors than the language serverlet y
must be let mut y
. do you even compile your examples? you should! the compiler gives better errors than the language server use iced_x86::code_asm::*;
let mut a = CodeAssembler::new(64)?;
/*
endbr64
push rbp
mov rbp,rsp
mov DWORD PTR [rbp-0x4],0x0
mov eax,0x2
pop rbp
ret
*/
a.endbr64()?;
a.push(rbp)?;
a.mov(rbp, rsp)?;
a.mov(dword_ptr(rbp - 0x4), 0)?;
a.mov(eax, 2u32)?;
a.pop(rbp)?;
a.ret()?;
(edited)a.ret()
return?let y
must be let mut y
. do you even compile your examples? you should! the compiler gives better errors than the language server a.ret()
return? pub(crate) fn add_instr(&mut self, mut instruction: Instruction) -> Result<(), IcedError> {
if !self.current_label.is_empty() && self.defined_anon_label {
return Err(IcedError::new("You can't create both an anonymous label and a normal label"));
}
if !self.current_label.is_empty() {
instruction.set_ip(self.current_label.id());
} else if self.defined_anon_label {
instruction.set_ip(self.current_anon_label.id());
}
if self.prefix_flags != 0 {
if (self.prefix_flags & PrefixFlags::LOCK) != 0 {
instruction.set_has_lock_prefix(true);
}
if (self.prefix_flags & PrefixFlags::REPE) != 0 {
instruction.set_has_repe_prefix(true);
} else if (self.prefix_flags & PrefixFlags::REPNE) != 0 {
instruction.set_has_repne_prefix(true);
}
if (self.prefix_flags & PrefixFlags::NOTRACK) != 0 {
instruction.set_segment_prefix(Register::DS);
}
}
self.instructions.push(instruction);
self.current_label = CodeLabel::default();
self.defined_anon_label = false;
self.prefix_flags = PrefixFlags::NONE;
Ok(())
}
fn foo_mut<'a>(_: &'a mut &'a String) {
// This function signature means take an exclusive reference for the entire rest of it's validity
}
fn foo<'a>(_: &'a &'a String) {}
fn main() {
let x = String::new();
let mut y: &String = &x;
foo(&y);
foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want
foo_mut(&mut y);
// Reference is eaten and still in use, so it's not possible to use `y`
// Something about &mut T being invariant over T but covariant over 'a
drop(y);
}
(edited)foo_mut
, but foo_mut
constarains how long the inner reference y
is valid, I think. but I'm not entirely sure about this.unwrap()
instead of using ?
? not surefoo_mut
, but foo_mut
constarains how long the inner reference y
is valid, I think. but I'm not entirely sure about this x
but it is :\&'a mut T<'a>
or you are a bad person (edited)&'a mut T<'a>
or you are a bad person (edited)sv_no_weak_hook 1
https://ddnet.org/settingscommands/fn foo_mut<'a>(_: &'a mut &'a String) {
// This function signature means take an exclusive reference for the entire rest of it's validity
}
fn foo<'a>(_: &'a &'a String) {}
fn main() {
let x = String::new();
let mut y: &String = &x;
foo(&y);
foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want
foo_mut(&mut y);
// Reference is eaten and still in use, so it's not possible to use `y`
// Something about &mut T being invariant over T but covariant over 'a
drop(y);
}
(edited)x
instead of y
, will it be the place where y
will not be valid anymorestd::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
Console()->ExecuteLine("say /pause");
std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
IInput::FLAG_TEXT
never have a key, so this additional check for modifier keys is redundant.
cuda
package, 4.8GB installed size&'a T<'a>
and still didn't check repo's code of what I wanted to check at the first place&'a T<'a>
and still didn't check repo's code of what I wanted to check at the first place rm -rf result
#!/usr/bin/expect
# Define the variables
set timeout -1
set host [lindex $argv 0];
set user "user"
# Catch password
stty -echo
send_user -- "Password for $user@$host: "
expect_user -re "(.*)\n"
send_user "\n"
stty echo
set password $expect_out(1,string)
set timestamp [timestamp -format %Y-%m-%d_%H:%M]
set logfile $env(HOME)/ssh_logs/session_$timestamp.log
log_file -a $logfile
# Start the SSH session
spawn ssh $user@$host
expect "Access restricted to authorized users"
# Handle the password prompt
stty -echo
expect {
"assword:" {
send "$password\r"
}
}
# Send the commands you want to execute
expect ">"
send "rows 0\r"
# Keep the shell open
interact
Nothing confidential but an expect script looks like this