mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
breaking,checker: disallow initializing private struct fields outside structs module (#21183)
This commit is contained in:
parent
a8d0cdd31b
commit
1a35a783f1
96 changed files with 225 additions and 111 deletions
|
@ -11,6 +11,7 @@ const max_parallel_workers = runtime.nr_jobs()
|
|||
|
||||
@[params]
|
||||
pub struct ParserSettings {
|
||||
pub:
|
||||
sequential bool
|
||||
img bool
|
||||
extra_workers int
|
||||
|
|
|
@ -11,6 +11,7 @@ pub const default_gravity = 4.9
|
|||
|
||||
@[params]
|
||||
pub struct SimParams {
|
||||
pub:
|
||||
rope_length f64 = sim.default_rope_length
|
||||
bearing_mass f64 = sim.default_bearing_mass
|
||||
magnet_spacing f64 = sim.default_magnet_spacing
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module sim
|
||||
|
||||
pub struct SimState {
|
||||
mut:
|
||||
pub mut:
|
||||
position Vector3D
|
||||
velocity Vector3D
|
||||
accel Vector3D
|
||||
|
|
|
@ -4,6 +4,7 @@ import math
|
|||
|
||||
// Vector3D is a 3D vector
|
||||
pub struct Vector3D {
|
||||
pub:
|
||||
x f64
|
||||
y f64
|
||||
z f64
|
||||
|
|
|
@ -7,10 +7,10 @@ const max_iterations = 1000
|
|||
const simulation_delta_t = 0.0005
|
||||
|
||||
pub struct SimRequest {
|
||||
pub:
|
||||
params SimParams
|
||||
state SimState
|
||||
pub:
|
||||
id int
|
||||
id int
|
||||
}
|
||||
|
||||
pub struct SimResult {
|
||||
|
|
|
@ -27,7 +27,7 @@ fn remap(v f64, min f64, max f64, new_min f64, new_max f64) f64 {
|
|||
|
||||
// Particle
|
||||
pub struct Particle {
|
||||
mut:
|
||||
pub mut:
|
||||
location vec.Vec2[f64]
|
||||
velocity vec.Vec2[f64]
|
||||
acceleration vec.Vec2[f64]
|
||||
|
|
|
@ -7,10 +7,12 @@ import rand
|
|||
import sokol.sgl
|
||||
|
||||
pub struct SystemConfig {
|
||||
pub:
|
||||
pool int
|
||||
}
|
||||
|
||||
pub struct System {
|
||||
pub:
|
||||
width int
|
||||
height int
|
||||
mut:
|
||||
|
|
|
@ -40,11 +40,9 @@ fn new_app() !&App {
|
|||
}
|
||||
|
||||
fn new_websocker_server() !&websocket.Server {
|
||||
mut wss := &websocket.Server{
|
||||
logger: &log.Log{
|
||||
level: .debug
|
||||
}
|
||||
}
|
||||
mut logger := &log.Log{}
|
||||
logger.set_level(.debug)
|
||||
mut wss := websocket.new_server(.ip, 8080, '', logger: logger)
|
||||
wss.on_connect(fn (mut server_client websocket.ServerClient) !bool {
|
||||
slog('ws.on_connect, server_client.client_key: ${server_client.client_key}')
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue